From 9a40249c00583baedd1c9f3e8405d36e796dde5b Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Mon, 2 May 2022 20:50:05 -0500 Subject: [PATCH] Fixed error when switching between saves with different layers --- src/util/save.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/save.ts b/src/util/save.ts index 3f5f1d6..6e602e4 100644 --- a/src/util/save.ts +++ b/src/util/save.ts @@ -102,8 +102,10 @@ export async function loadSave(playerObj: Partial): Promise { const { fixOldSave, getInitialLayers } = await import("data/projEntry"); for (const layer in layers) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - removeLayer(layers[layer]!); + const l = layers[layer]; + if (l) { + removeLayer(l); + } } getInitialLayers(playerObj).forEach(layer => addLayer(layer, playerObj));