Commit 93fadfbd authored by Christian Winter's avatar Christian Winter

error handling when trying to load corrupted autosave file

parent 7a54bce7
Pipeline #4779795 passed with stage
in 59 seconds
......@@ -118,11 +118,7 @@ class Logic {
Camera.canvasOffset.x = canvas.width * 0.5;
Camera.canvasOffset.y = canvas.height * 0.5;
//*
Saver.loadAutoSave();
/*/
Saver.newFile();
// */
File.updateStats();
Renderer.redraw();
......
......@@ -12,14 +12,21 @@
static loadAutoSave() // SIFU TODO combine with loading from file
{
let autoSaveFile = localStorage.getItem(this.autosaveFileName);
if (!autoSaveFile) {
Saver.newFile();
return;
}
try {
this.createFileFromSVGString(autoSaveFile);
Renderer.redraw();
let autoSaveFile = localStorage.getItem(this.autosaveFileName);
if (!autoSaveFile) {
Saver.newFile();
return;
}
this.createFileFromSVGString(autoSaveFile);
Renderer.redraw();
}
catch (err) {
this.newFile();
GUI.notify("Error loading previous session. Created new one.", 'green');
}
}
static newFile() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment