From 0df4f74fdc471f74ec03f6fb88a0339589daa519 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 10 Dec 2024 09:54:27 +0800 Subject: [PATCH] Update --- cocos/2d/renderer/render-draw-info.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cocos/2d/renderer/render-draw-info.ts b/cocos/2d/renderer/render-draw-info.ts index e1a0924b73d..45a0402cb6a 100644 --- a/cocos/2d/renderer/render-draw-info.ts +++ b/cocos/2d/renderer/render-draw-info.ts @@ -90,7 +90,7 @@ export class RenderDrawInfo { protected declare _uint32SharedBuffer: Uint32Array; // SharedBuffer of pos/uv/color - protected _render2dBuffer: Float32Array = null!; + protected _render2dBuffer: Float32Array | null = null; constructor (nativeDrawInfo?: NativeRenderDrawInfo) { this.init(nativeDrawInfo); @@ -107,7 +107,7 @@ export class RenderDrawInfo { return this._nativeObj; } - get render2dBuffer (): Float32Array { + get render2dBuffer (): Float32Array | null { return this._render2dBuffer; } @@ -301,6 +301,9 @@ export class RenderDrawInfo { public fillRender2dBuffer (vertexDataArr: IRenderData[]): void { if (JSB) { + if (!this._render2dBuffer) { + return; + } const fillLength = Math.min(this._vbCount, vertexDataArr.length); let bufferOffset = 0; for (let i = 0; i < fillLength; i++) {