summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-10-09 13:44:34 +0000
committerhallgren <hallgren@chalmers.se>2012-10-09 13:44:34 +0000
commit4c0b6f29f26a3c27c7f90615b71627406bcfea6f (patch)
treef7b4b80b4a566b4c53af05b8a9f786c92f933542 /src
parentf53ab8b3535d32044386be55127f30e96f691e92 (diff)
gfse: show the grammar list if the currently selected grammar can not be loaded
Avoid showing a blank page if there is an unexpected problem with the grammars in localStorage.
Diffstat (limited to 'src')
-rw-r--r--src/www/gfse/editor.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/www/gfse/editor.js b/src/www/gfse/editor.js
index 81901a3bd..9d3c0d753 100644
--- a/src/www/gfse/editor.js
+++ b/src/www/gfse/editor.js
@@ -199,9 +199,15 @@ function clone_grammar(i) {
function open_grammar(i) {
var g=get_grammar(i);
- g.index=i;
- local.put("current",i+1);
- edit_grammar(g);
+ if(g) {
+ g.index=i;
+ local.put("current",i+1);
+ edit_grammar(g);
+ }
+ else {
+ alert("Something went wrong: grammar at index "+i+" is not usable.")
+ draw_grammar_list()
+ }
}
function open_public(file) {