Skip to content

Commit

Permalink
Add a judgment at the very beginning of the function
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuguohua committed Jan 12, 2024
1 parent 03fa14e commit a3aa0fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cocos/2d/renderer/static-vb-accessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ export class StaticVBAccessor extends BufferAccessor {

public allocateChunk (vertexCount: number, indexCount: number): StaticVBChunk | null {
const byteLength = vertexCount * this.vertexFormatBytes;
if (vertexCount <= this._vCount) {
errorID(9004, byteLength);
return null;
}
let buf: MeshBuffer = null!; let freeList: IFreeEntry[];
let bid = 0; let eid = -1; let entry: IFreeEntry | null = null;
// Loop buffers
Expand Down

0 comments on commit a3aa0fe

Please sign in to comment.