Skip to content

Commit 08e0f83

Browse files
Apply suggestions from code review
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 1a042da commit 08e0f83

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

engine/native/main/main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ int main(int argc, char* argv[])
5656
}
5757

5858
// Init the RHI with the native window handle and initial size
59-
draco::rhi::init(ndt, nwh, 1280, 720);
59+
if (!draco::rhi::init(ndt, nwh, 1280, 720)) {
60+
std::println("Failed to initialize RHI");
61+
SDL_DestroyWindow(window);
62+
SDL_Quit();
63+
return -1;
64+
}
6065

6166
// Geometry data for a triangle to test rendering
6267
// It includes both positions & colors

engine/native/rendering/rhi/rhi_bgfx.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ namespace draco::rhi
155155

156156
if (p.index_buffer != UINT16_MAX)
157157
{
158+
if (p.index_buffer >= g_buffers.size()) {
159+
std::println("Error: Invalid index buffer handle in RenderPacket");
160+
return;
161+
}
158162
Buffer& ib = g_buffers[p.index_buffer];
159163
if (ib.is_index)
160164
bgfx::setIndexBuffer(ib.ibh);

0 commit comments

Comments
 (0)