Skip to content

Commit 7fe166d

Browse files
authored
avoid exception in ChromiumBookmarkLoader.cs
Every time I start Flow Launcher since the plugins refactor, the Bookmarks plugin has been throwing an exception. The issue stems from it parsing the Bookmarks file, and assuming that every JsonElement in the "roots" element is a JsonValueKind.Object. My Bookmarks file though has a JsonValueKind.String value off the roots key of `"sync_transaction_version": "20297",` along-side the bookmark_bar, other, and synced keys, which ARE objects. When it hits that sync_transaction_version string, and calls EnumerateFolderBookmark with it, it gets into the method because it IS a JsonElement, but then throws an exception on the folderElement.TryGetProperty("children", ...) call because you can't call TryGetProperty on a String, only Objects.
1 parent dd8135e commit 7fe166d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ protected List<Bookmark> LoadBookmarksFromFile(string path, string source)
3737
return new();
3838
foreach (var folder in rootElement.EnumerateObject())
3939
{
40-
EnumerateFolderBookmark(folder.Value, bookmarks, source);
40+
if (folder.Value.ValueKind == JsonValueKind.Object)
41+
EnumerateFolderBookmark(folder.Value, bookmarks, source);
4142
}
4243
return bookmarks;
4344
}
@@ -64,4 +65,4 @@ private void EnumerateFolderBookmark(JsonElement folderElement, List<Bookmark> b
6465

6566
}
6667
}
67-
}
68+
}

0 commit comments

Comments
 (0)