vakata/jstree — Issue #182: xml plugin get_xml crash
Author: wonggei
Created: 2012-03-08 07:48:25+00:00
State: open

when there is an empty node (node without content), get_text() will crash at the following line.

else {
obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
return obj.nodeValue;
}

Since obj is undefined, obj.nodeValue crash.
This can be avoided by checking if the obj is valid or not.

else {
obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
if(obj)
return obj.nodeValue;
else
return "";

}