Browse Source

HUE-5080 [editor] Fix JS error for SQL syntax error checker

Johan Ahlen 9 years ago
parent
commit
4d1e075
1 changed files with 4 additions and 2 deletions
  1. 4 2
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

+ 4 - 2
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -2932,8 +2932,10 @@
             e.data.errors.forEach(function (error) {
               if (error.expected.length > 0) {
                 var token = editor.session.getTokenAt(error.loc.first_line - 1, error.loc.first_column);
-                token.error = error;
-                editor.session.addMarker(new AceRange(error.loc.first_line - 1, error.loc.first_column, error.loc.last_line - 1, error.loc.last_column), 'hue-ace-error', 'fail');
+                if (token) {
+                  token.error = error;
+                  editor.session.addMarker(new AceRange(error.loc.first_line - 1, error.loc.first_column, error.loc.last_line - 1, error.loc.last_column), 'hue-ace-error', 'fail');
+                }
               }
             });
           }