From edf8a3375a94f95a211b16ba25e3653777547d4a Mon Sep 17 00:00:00 2001 From: FallBackITA27 Date: Tue, 14 May 2024 11:06:36 +0200 Subject: [PATCH] security measure against deformed save data --- gtav-interactive-map/script.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gtav-interactive-map/script.js b/gtav-interactive-map/script.js index 7bb508e..cf5d511 100644 --- a/gtav-interactive-map/script.js +++ b/gtav-interactive-map/script.js @@ -9,8 +9,16 @@ let saveData = { } } -let temporarySaveData = localStorage.getItem("saveData"); -if (temporarySaveData != null) saveData = JSON.parse(temporarySaveData); +let temporarySaveDataStr = localStorage.getItem("saveData"); +if (temporarySaveDataStr != null) { + let temporarySaveData = JSON.parse(temporarySaveDataStr); + for (key in saveData.profile0) { + temporarySaveData.profile0[key] === null; + temporarySaveData.profile0[key] = saveData.profile0[key]; + } + saveData = temporarySaveData; + +} saveDataSave(); let map = L.map('map', {