Fixed error when switching between saves with different layers

This commit is contained in:
thepaperpilot 2022-05-02 20:50:05 -05:00
parent 2d9de00424
commit 9a40249c00

View file

@ -102,8 +102,10 @@ export async function loadSave(playerObj: Partial<PlayerData>): Promise<void> {
const { fixOldSave, getInitialLayers } = await import("data/projEntry"); const { fixOldSave, getInitialLayers } = await import("data/projEntry");
for (const layer in layers) { for (const layer in layers) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion const l = layers[layer];
removeLayer(layers[layer]!); if (l) {
removeLayer(l);
}
} }
getInitialLayers(playerObj).forEach(layer => addLayer(layer, playerObj)); getInitialLayers(playerObj).forEach(layer => addLayer(layer, playerObj));