Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 39d2522

Browse files
committed
Work around db.read_tag() returning null
This shouldn't happen, but it does sometimes. For now, at least make us not crash.
1 parent 731e1bd commit 39d2522

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Widgets/RemovePopover.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ private void removeTag()
8282
var notification = MainWindow.get_default().showNotification(text);
8383

8484
ulong eventID = notification.dismissed.connect(() => {
85-
FeedReaderBackend.get_default().deleteTag(DataBase.readOnly().read_tag(m_id));
85+
var tag = DataBase.readOnly().read_tag(m_id);
86+
if(tag != null)
87+
FeedReaderBackend.get_default().deleteTag(tag);
8688
});
8789
notification.action.connect(() => {
8890
notification.disconnect(eventID);

src/Widgets/TagPopover.vala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ public TagPopover(Gtk.Widget widget)
3535
Gee.List<string> tagIDs = selectedArticle.getTagIDs();
3636
foreach(string tagID in tagIDs)
3737
{
38-
m_tags.add(db.read_tag(tagID));
38+
var tag = db.read_tag(tagID);
39+
// FIXME: Sometimes articles claim to have tags that don't exist
40+
// in the DB. This works around that but we should fix the
41+
// underlying problem at some point
42+
if (tag != null)
43+
m_tags.add(tag);
3944
}
4045
}
4146

0 commit comments

Comments
 (0)