From 4ae206fc0069d4d3d9471d2c32efdee18b283df2 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 7 Feb 2008 21:23:42 +0000 Subject: [PATCH] Turns out some code likes to call isa() with non-objects. Might as well have it return false (which is valid) instead of throwing an exception (also valid, but more surprising). --- Nasal/globals.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/globals.nas b/Nasal/globals.nas index 0b29e8572..e0a5623c2 100644 --- a/Nasal/globals.nas +++ b/Nasal/globals.nas @@ -3,7 +3,7 @@ # (class) object. Example: isa(someObject, props.Node) # var isa = func(obj, class) { - if(contains(obj, "parents")) + if(typeof(obj) == "hash" and obj["parents"] != nil) foreach(c; obj.parents) if(c == class or isa(c, class)) return 1; @@ -31,7 +31,7 @@ var fgcommand = func(cmd, node=nil) { var cmdarg = func { props.wrapNode(_cmdarg()) } ## -# Utility. Does what it you think it does. +# Utility. Does what you think it does. # var abs = func(v) { return v < 0 ? -v : v }