Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jangernert/FeedReader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Long <self@brendanlong.com>2019-02-01 22:26:56 +0300
committerBrendan Long <self@brendanlong.com>2019-02-01 22:29:53 +0300
commit39d252239bdc4d6c007c9e6bc1558a429105c8ed (patch)
treea60cf5791cdcb96444f308af4f87e5fcb5cf7801
parent731e1bd6f0679a704f7c049bf80766bdab45c892 (diff)
Work around db.read_tag() returning null
This shouldn't happen, but it does sometimes. For now, at least make us not crash.
-rw-r--r--src/Widgets/RemovePopover.vala4
-rw-r--r--src/Widgets/TagPopover.vala7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/Widgets/RemovePopover.vala b/src/Widgets/RemovePopover.vala
index 93d1b129..1d2ddc33 100644
--- a/src/Widgets/RemovePopover.vala
+++ b/src/Widgets/RemovePopover.vala
@@ -82,7 +82,9 @@ private void removeTag()
var notification = MainWindow.get_default().showNotification(text);
ulong eventID = notification.dismissed.connect(() => {
- FeedReaderBackend.get_default().deleteTag(DataBase.readOnly().read_tag(m_id));
+ var tag = DataBase.readOnly().read_tag(m_id);
+ if(tag != null)
+ FeedReaderBackend.get_default().deleteTag(tag);
});
notification.action.connect(() => {
notification.disconnect(eventID);
diff --git a/src/Widgets/TagPopover.vala b/src/Widgets/TagPopover.vala
index bbba5981..6268e436 100644
--- a/src/Widgets/TagPopover.vala
+++ b/src/Widgets/TagPopover.vala
@@ -35,7 +35,12 @@ public TagPopover(Gtk.Widget widget)
Gee.List<string> tagIDs = selectedArticle.getTagIDs();
foreach(string tagID in tagIDs)
{
- m_tags.add(db.read_tag(tagID));
+ var tag = db.read_tag(tagID);
+ // FIXME: Sometimes articles claim to have tags that don't exist
+ // in the DB. This works around that but we should fix the
+ // underlying problem at some point
+ if (tag != null)
+ m_tags.add(tag);
}
}