From 5d8692f16a1d265b2a97937935d6718b6c68d65a Mon Sep 17 00:00:00 2001 From: Aran Leite Date: Sun, 3 Jan 2021 01:58:18 -0300 Subject: [PATCH] Fixed bug #12 From https://github.com/cookie-crumb/cookie-garden-helper --- cookie-garden-helper.js | 2 +- src/Garden.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cookie-garden-helper.js b/cookie-garden-helper.js index 09d995b..262730e 100644 --- a/cookie-garden-helper.js +++ b/cookie-garden-helper.js @@ -153,7 +153,7 @@ class Garden { if (plant.weed && config.autoHarvestWeeds) { this.harvest(x, y); } - let [seedId] = config.savedPlot[y][x]; + let [seedId] = config.savedPlot.length > 0 ? config.savedPlot[y][x] : [0, 0]; seedId -= 1; if ( config.autoHarvestCleanGarden && diff --git a/src/Garden.js b/src/Garden.js index 09963a0..d6414ae 100644 --- a/src/Garden.js +++ b/src/Garden.js @@ -103,7 +103,7 @@ class Garden { if (plant.weed && config.autoHarvestWeeds) { this.harvest(x, y); } - let [seedId] = config.savedPlot[y][x]; + let [seedId] = config.savedPlot.length > 0 ? config.savedPlot[y][x] : [0, 0]; seedId -= 1; if ( config.autoHarvestCleanGarden &&