added defensive coding when removing node from container in case it has not yet been added to the container

This commit is contained in:
Eric Rowell 2012-04-28 13:06:22 -07:00
parent 8dce92c2fd
commit 6bed850042
3 changed files with 5 additions and 5 deletions

View File

@ -1043,7 +1043,7 @@ Kinetic.Container.prototype = {
* @param {Node} child
*/
_remove: function(child) {
if(this.children[child.index]._id == child._id) {
if(child.index !== undefined && this.children[child.index]._id == child._id) {
var stage = this.getStage();
if(stage !== undefined) {
stage._removeId(child);

File diff suppressed because one or more lines are too long

View File

@ -30,9 +30,9 @@ Kinetic.Container.prototype = {
/**
* remove child from container
* @param {Node} child
*/
*/
_remove: function(child) {
if(this.children[child.index]._id == child._id) {
if(child.index !== undefined && this.children[child.index]._id == child._id) {
var stage = this.getStage();
if(stage !== undefined) {
stage._removeId(child);