From 7c2dba8fe0e3fed262e98e73939fd8128b601b82 Mon Sep 17 00:00:00 2001 From: Mark DiMarco Date: Thu, 6 Sep 2012 16:55:04 -0500 Subject: [PATCH] safer check for result.children `("children" in result) && result.children.length` fails if children is explicitly null. --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 2b5e5c4e..44d0e924 100755 --- a/select2.js +++ b/select2.js @@ -692,7 +692,7 @@ result=results[i]; selectable=id(result) !== undefined; - compound=("children" in result) && result.children.length > 0; + compound=result.children && result.children.length > 0; node=$("
  • "); node.addClass("select2-results-dept-"+depth);