]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Fixed presence detection bug in utils.set_defaults
authorSolly Ross <sross@redhat.com>
Fri, 19 Sep 2014 18:48:00 +0000 (14:48 -0400)
committerSolly Ross <sross@redhat.com>
Fri, 19 Sep 2014 18:48:00 +0000 (14:48 -0400)
Previously, Utils.set_defaults was using `if(conf[keys[i]])`
to check for the presence of a configuration key.  This would
fail if `conf[keys[i]]` happened to be false.  Instead, we now
use `if(keys[i] in conf)`, which simply checks for the presence
of the key in the conf object.

include/util.js

index a6045dacf1e19f058ac93ec10afa390987a405ae..9e5f98c919027fd52b04b8f1f6ea5678ba49a225 100644 (file)
@@ -346,7 +346,7 @@ Util.set_defaults = function (obj, conf, defaults) {
           continue;
         }
 
-        if (conf[keys[i]]) {
+        if (keys[i] in conf) {
             setter.call(obj, conf[keys[i]]);
         } else {
             setter.call(obj, defaults[keys[i]]);