Skip to content

Commit

Permalink
[fix] avoid loading exception
Browse files Browse the repository at this point in the history
  • Loading branch information
BioCrossCoder committed Jan 3, 2025
1 parent 4c9ae52 commit 408ec5c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/entrypoints/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ let data = {} as Record<string, Node>;

class GraphStorage {
public static async load(): Promise<void> {
const dataToLoad = await storage.getItem(storageKey) as GraphData;
const dataToLoad: GraphData | null = await storage.getItem(storageKey);
if (!dataToLoad) {
return
}
const relatedNodes = new Map<string, string[]>();
dataToLoad.edges.forEach(([id1, id2]) => {
if (!relatedNodes.has(id1)) {
Expand Down

0 comments on commit 408ec5c

Please sign in to comment.