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.
This commit is contained in:
Martin André 2014-09-17 16:31:12 +09:00
parent 0ca7cf4867
commit 7caa9c20c2
1 changed files with 4 additions and 0 deletions

View File

@ -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]]);