From 96950f1cc8e7d53654c6df78e12b5b2f8b667ac5 Mon Sep 17 00:00:00 2001 From: andrewstart Date: Thu, 26 May 2022 21:59:41 -0400 Subject: [PATCH] Fix LinkedListContainer.destroy() throwing an error. --- src/LinkedListContainer.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/LinkedListContainer.ts b/src/LinkedListContainer.ts index 744dd33f..8ee4ba1a 100644 --- a/src/LinkedListContainer.ts +++ b/src/LinkedListContainer.ts @@ -519,6 +519,13 @@ export class LinkedListContainer extends Container public removeChildren(beginIndex = 0, endIndex = this._childCount): DisplayObject[] { const begin = beginIndex; + + // because Container.destroy() has removeChildren(0, this.children.count), assume that an end index of 0 + // should actually be _childCount. + if (endIndex === 0 && this._childCount > 0) + { + endIndex = this._childCount; + } const end = endIndex; const range = end - begin;