Skip to content

Commit 2fd6e4e

Browse files
committed
Fixed out of range error when buffer is empty
1 parent d63460d commit 2fd6e4e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

engine/core/subsystem/RenderSystem.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ bool RenderSystem::drawMesh(MeshComponent& mesh, Transform& transform, CameraCom
985985

986986
if (instmesh->needUpdateBuffer){
987987
// setData here because component can change order and lose reference
988-
instmesh->buffer.setData((unsigned char*)(&instmesh->renderInstances.at(0)), sizeof(InstanceRenderData)*instmesh->numVisible);
988+
instmesh->buffer.setData((unsigned char*)(&instmesh->renderInstances[0]), sizeof(InstanceRenderData)*instmesh->numVisible);
989989
instmesh->buffer.getRender()->updateBuffer(instmesh->buffer.getSize(), instmesh->buffer.getData());
990990

991991
instmesh->needUpdateBuffer = false;
@@ -1532,7 +1532,7 @@ bool RenderSystem::drawPoints(PointsComponent& points, Transform& transform, Tra
15321532

15331533
if (points.needUpdateBuffer){
15341534
// setData here because component can change order and lose reference
1535-
points.buffer.setData((unsigned char*)(&points.renderPoints.at(0)), sizeof(PointRenderData)*points.numVisible);
1535+
points.buffer.setData((unsigned char*)(&points.renderPoints[0]), sizeof(PointRenderData)*points.numVisible);
15361536
points.buffer.getRender()->updateBuffer(points.buffer.getSize(), points.buffer.getData());
15371537
points.needUpdateBuffer = false;
15381538
}
@@ -1583,7 +1583,7 @@ bool RenderSystem::drawLines(LinesComponent& lines, Transform& transform, Transf
15831583

15841584
if (lines.needUpdateBuffer){
15851585
// setData here because component can change order and lose reference
1586-
lines.buffer.setData((unsigned char*)(&lines.lines.at(0)), sizeof(LineData)*lines.lines.size());
1586+
lines.buffer.setData((unsigned char*)(&lines.lines[0]), sizeof(LineData)*lines.lines.size());
15871587
lines.buffer.getRender()->updateBuffer(lines.buffer.getSize(), lines.buffer.getData());
15881588
lines.needUpdateBuffer = false;
15891589
}

0 commit comments

Comments
 (0)