Skip to content

Commit

Permalink
fixed #17016: wrong assertion if label is empty and uses BitmapFont
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar committed Dec 10, 2024
1 parent 0ec0ec3 commit 67d9f4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cocos/2d/renderer/render-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,9 @@ export class RenderData extends BaseRenderData {
// Hack Do not update pre frame
if (JSB && this.multiOwner === false) {
if (DEBUG) {
assert(this._renderDrawInfo.render2dBuffer.length === this._floatStride * this._data.length, 'Vertex count doesn\'t match.');
if (this._renderDrawInfo && this._renderDrawInfo.render2dBuffer) {
assert(this._renderDrawInfo.render2dBuffer.length === this._floatStride * this._data.length, 'Vertex count doesn\'t match.');
}
}
// sync shared buffer to native
this._renderDrawInfo.fillRender2dBuffer(this._data);
Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/renderer/render-draw-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class RenderDrawInfo {
protected declare _uint32SharedBuffer: Uint32Array;

// SharedBuffer of pos/uv/color
protected declare _render2dBuffer: Float32Array;
protected _render2dBuffer: Float32Array = null!;

constructor (nativeDrawInfo?: NativeRenderDrawInfo) {
this.init(nativeDrawInfo);
Expand Down

0 comments on commit 67d9f4f

Please sign in to comment.