Fix importing opml file with empty url and title (#6966)
This commit is contained in:
parent
22f36bc9c0
commit
e8807bb329
|
@ -1,5 +1,6 @@
|
||||||
package de.danoeh.antennapod.core.export.opml;
|
package de.danoeh.antennapod.core.export.opml;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
@ -53,7 +54,7 @@ public class OpmlReader {
|
||||||
OpmlElement element = new OpmlElement();
|
OpmlElement element = new OpmlElement();
|
||||||
|
|
||||||
final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE);
|
final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE);
|
||||||
if (title != null) {
|
if (!TextUtils.isEmpty(title)) {
|
||||||
Log.i(TAG, "Using title: " + title);
|
Log.i(TAG, "Using title: " + title);
|
||||||
element.setText(title);
|
element.setText(title);
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,8 +64,8 @@ public class OpmlReader {
|
||||||
element.setXmlUrl(xpp.getAttributeValue(null, OpmlSymbols.XMLURL));
|
element.setXmlUrl(xpp.getAttributeValue(null, OpmlSymbols.XMLURL));
|
||||||
element.setHtmlUrl(xpp.getAttributeValue(null, OpmlSymbols.HTMLURL));
|
element.setHtmlUrl(xpp.getAttributeValue(null, OpmlSymbols.HTMLURL));
|
||||||
element.setType(xpp.getAttributeValue(null, OpmlSymbols.TYPE));
|
element.setType(xpp.getAttributeValue(null, OpmlSymbols.TYPE));
|
||||||
if (element.getXmlUrl() != null) {
|
if (!TextUtils.isEmpty(element.getXmlUrl())) {
|
||||||
if (element.getText() == null) {
|
if (!TextUtils.isEmpty(element.getText())) {
|
||||||
Log.i(TAG, "Opml element has no text attribute.");
|
Log.i(TAG, "Opml element has no text attribute.");
|
||||||
element.setText(element.getXmlUrl());
|
element.setText(element.getXmlUrl());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue