diff --git a/spine-ts/spine-pixi-v8/src/SpinePipe.ts b/spine-ts/spine-pixi-v8/src/SpinePipe.ts index 44f71c1a8..2b01dab4e 100644 --- a/spine-ts/spine-pixi-v8/src/SpinePipe.ts +++ b/spine-ts/spine-pixi-v8/src/SpinePipe.ts @@ -46,7 +46,7 @@ const spineBlendModeMap: Record = { 3: 'screen' }; -type GpuSpineDataElement = { slotBatches: Record }; +type GpuSpineDataElement = { slotBatches: Record }; // eslint-disable-next-line max-len export class SpinePipe implements RenderPipe { @@ -93,8 +93,8 @@ export class SpinePipe implements RenderPipe { const texture = cacheData.texture; - if (texture !== batchableSpineSlot.texture) { - if (!batchableSpineSlot._batcher.checkAndUpdateTexture(batchableSpineSlot, texture)) { + if (texture !== batchableSpineSlot?.texture) { + if (!batchableSpineSlot?._batcher.checkAndUpdateTexture(batchableSpineSlot, texture)) { return true; } } @@ -176,9 +176,9 @@ export class SpinePipe implements RenderPipe { const cacheData = spine._getCachedData(slot, attachment); if (!cacheData.skipRender) { - const batchableSpineSlot = gpuSpine.slotBatches[spine._getCachedData(slot, attachment).id]; - - batchableSpineSlot._batcher?.updateElement(batchableSpineSlot); + const batchableSpineSlot = gpuSpine.slotBatches[cacheData.id]; + // we didn't figure out why batchableSpineSlot might be undefined: https://github.com/EsotericSoftware/spine-runtimes/issues/2991 + batchableSpineSlot?._batcher?.updateElement(batchableSpineSlot); } } }