Fix importing opml file with empty url and title (#6966)

This commit is contained in:
ByteHamster 2024-03-07 22:54:34 +01:00 committed by GitHub
parent 22f36bc9c0
commit e8807bb329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package de.danoeh.antennapod.core.export.opml;
import android.text.TextUtils;
import android.util.Log;
import org.xmlpull.v1.XmlPullParser;
@ -53,7 +54,7 @@ public class OpmlReader {
OpmlElement element = new OpmlElement();
final String title = xpp.getAttributeValue(null, OpmlSymbols.TITLE);
if (title != null) {
if (!TextUtils.isEmpty(title)) {
Log.i(TAG, "Using title: " + title);
element.setText(title);
} else {
@ -63,8 +64,8 @@ public class OpmlReader {
element.setXmlUrl(xpp.getAttributeValue(null, OpmlSymbols.XMLURL));
element.setHtmlUrl(xpp.getAttributeValue(null, OpmlSymbols.HTMLURL));
element.setType(xpp.getAttributeValue(null, OpmlSymbols.TYPE));
if (element.getXmlUrl() != null) {
if (element.getText() == null) {
if (!TextUtils.isEmpty(element.getXmlUrl())) {
if (!TextUtils.isEmpty(element.getText())) {
Log.i(TAG, "Opml element has no text attribute.");
element.setText(element.getXmlUrl());
}