1
0
Fork 0

getBoolValue() on an undefined node shall return "false", not "true".

This isn't only more logical, it's also how SGPropertyNode::getBoolValue()
acts. The fix has potential to break code, but so far I haven't seen any
problems. I added a debug message to my copy and will for a while check
all cases that I run into. To check yourself, just add one line:

    getBoolValue : func {
        val = me.getValue();
+       if(val == nil) { debug.dump(me) }
        if(me.getType() == "STRING" and val == "false") { 0 }
        else { val != nil and val != 0 }
    }

This will output a debug message to the terminal for each case where
formerly "true" was returned, and now "false" is.
This commit is contained in:
mfranz 2007-02-05 11:40:49 +00:00
parent 3a3ee3a5d0
commit 0f07c14bd3

View file

@ -41,7 +41,7 @@ Node = {
getBoolValue : func {
val = me.getValue();
if(me.getType() == "STRING" and val == "false") { 0 }
else { val != 0 }
else { val != nil and val != 0 }
}
};