diff options
Diffstat (limited to 'scripts/buttons.js')
| -rw-r--r-- | scripts/buttons.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/buttons.js b/scripts/buttons.js index 65536f35..79a961ff 100644 --- a/scripts/buttons.js +++ b/scripts/buttons.js @@ -34,6 +34,7 @@ $('.save').click(function(){ $('.load').click(function(){ var acceptLoad=true; + if (nodes.length>0){ acceptLoad = confirm('All unsaved changes will be deleted, are you sure?'); } @@ -42,6 +43,10 @@ $('.load').click(function(){ links=[]; nodes=[]; var data = JSON.parse(localStorage.getItem(key)); + if (data == null) { + console.log('load callback: no data to load'); + return; + } console.log(data); for(var i=0; i<data["nodes"].length; i++){ var node=data.nodes[i]; |
