Avoid errors removing top-level widgets, check for parent property first

This commit is contained in:
Nathan Gray 2013-05-29 18:57:48 +00:00
parent 555de8e540
commit 0285ea4b28

View File

@ -233,8 +233,8 @@ var et2_widget = Class.extend(
this._children[i].free();
}
// Remove this element from the parent
if (this._parent !== null)
// Remove this element from the parent, if it exists
if (typeof this._parent != "undefined" && this._parent !== null)
{
this._parent.removeChild(this);
}