Browse Source

Prevent noVNC loading error when invalid property is set on object

Util.set_defaults should accommodate with missing properties to prevent
'Uncaught TypeError: Cannot read property 'call' of undefined' error.
Martin André 11 years ago
parent
commit
7caa9c20c2
1 changed files with 4 additions and 0 deletions
  1. 4 0
      include/util.js

+ 4 - 0
include/util.js

@@ -341,6 +341,10 @@ Util.set_defaults = function (obj, conf, defaults) {
 
     for (i = 0; i < keys.length; i++) {
         var setter = obj['_raw_set_' + keys[i]];
+        if (!setter) {
+          Util.Warn('Invalid property ' + keys[i]);
+          continue;
+        }
 
         if (conf[keys[i]]) {
             setter.call(obj, conf[keys[i]]);