Skip to content

Commit 29e2d69

Browse files
Merge pull request #177 from CodeForPhilly/feat/zbl-buildissue20251218
Improve summaryData computation by adding null checks for family and …
2 parents 4e18fe3 + 8c2f606 commit 29e2d69

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/GardenPlanner.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ const summaryData = computed(() => {
285285
familyMap.set(plantFamily, { plants: new Map() });
286286
}
287287
288-
const family = familyMap.get(plantFamily)!;
288+
const family = familyMap.get(plantFamily);
289+
if (!family) continue;
290+
289291
if (!family.plants.has(placed.plantId)) {
290292
family.plants.set(placed.plantId, {
291293
plantId: placed.plantId,
@@ -296,7 +298,9 @@ const summaryData = computed(() => {
296298
});
297299
}
298300
299-
const plantEntry = family.plants.get(placed.plantId)!;
301+
const plantEntry = family.plants.get(placed.plantId);
302+
if (!plantEntry) continue;
303+
300304
plantEntry.count++;
301305
plantEntry.coordinates.push(centerCoord);
302306
}

0 commit comments

Comments
 (0)