Skip to content

Commit 36913c0

Browse files
committed
Prevent error on disconnected callback
1 parent a82414c commit 36913c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spine-ts/spine-webgl/src/SpineWebComponentWidget.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,8 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable,
858858

859859
disconnectedCallback (): void {
860860
window.removeEventListener("DOMContentLoaded", this.DOMContentLoadedHandler);
861-
const index = this.overlay!.skeletonList.indexOf(this);
862-
if (index !== -1) {
861+
const index = this.overlay?.skeletonList.indexOf(this);
862+
if (index > 0) {
863863
this.overlay!.skeletonList.splice(index, 1);
864864
}
865865
}

0 commit comments

Comments
 (0)