diff --git a/MapBuilderForWeb/MapBuilder.js b/MapBuilderForWeb/MapBuilder.js index c494831..fb4d9a4 100644 --- a/MapBuilderForWeb/MapBuilder.js +++ b/MapBuilderForWeb/MapBuilder.js @@ -414,12 +414,17 @@ function Point(x, y){ /////////////////////////// UPLOAD ///////////////////////////////////////////////// function upload(uploadString){ - let mapsAndShapesString = uploadString.split("$"); - let mapsString = mapsAndShapesString[0].split("&"); - let shapesString = mapsAndShapesString[1].split("&"); - - uploadShapes(shapesString); - uploadMaps(mapsString); + let mapsAndShapesString, mapsString, shapesString; + try{ + mapsAndShapesString = uploadString.split("$"); + mapsString = mapsAndShapesString[0].split("&"); + shapesString = mapsAndShapesString[1].split("&"); + } catch{ alert("Couldn't parse. File corrupted"); return; } + + try{ uploadShapes(shapesString);} catch{ alert("Shapes couldn't be loaded"); return;} + + try{ uploadMaps(mapsString);} catch{ alert("Maps couldn't be loaded"); return;} + ChangeItem(0); } diff --git a/MapBuilderForWeb/MultimapMechanics.js b/MapBuilderForWeb/MultimapMechanics.js index fd9dd68..1f2074a 100644 --- a/MapBuilderForWeb/MultimapMechanics.js +++ b/MapBuilderForWeb/MultimapMechanics.js @@ -173,7 +173,9 @@ document.querySelector('input[type=file]').value = ""; } - try{ reader.readAsText( file ); } catch{} + if(file){ + try{ reader.readAsText( file ); } catch{ alert("This file Cannot be uploaded"); } + } } function downloadManager(){