Bläddra i källkod

Fixed presence detection bug in utils.set_defaults

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.
Solly Ross 11 år sedan
förälder
incheckning
cfc02e5e2b
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      include/util.js

+ 1 - 1
include/util.js

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