Skip to content

Commit fe39c86

Browse files
ImGuiRenderer: handle buffer mapping failure
1 parent 9a4e9a1 commit fe39c86

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Imgui/src/ImGuiDiligentRenderer.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,12 @@ void ImGuiDiligentRenderer::RenderDrawData(IDeviceContext* pCtx, ImDrawData* pDr
906906
}
907907

908908
{
909-
MapHelper<ImDrawVert> Verices(pCtx, m_pVB, MAP_WRITE, MAP_FLAG_DISCARD);
909+
MapHelper<ImDrawVert> Vertices(pCtx, m_pVB, MAP_WRITE, MAP_FLAG_DISCARD);
910910
MapHelper<ImDrawIdx> Indices(pCtx, m_pIB, MAP_WRITE, MAP_FLAG_DISCARD);
911+
if (!Vertices || !Indices)
912+
return;
911913

912-
ImDrawVert* pVtxDst = Verices;
914+
ImDrawVert* pVtxDst = Vertices;
913915
ImDrawIdx* pIdxDst = Indices;
914916
for (Int32 CmdListID = 0; CmdListID < pDrawData->CmdListsCount; CmdListID++)
915917
{
@@ -980,6 +982,9 @@ void ImGuiDiligentRenderer::RenderDrawData(IDeviceContext* pCtx, ImDrawData* pDr
980982
}
981983

982984
MapHelper<float4x4> CBData(pCtx, m_pVertexConstantBuffer, MAP_WRITE, MAP_FLAG_DISCARD);
985+
if (!CBData)
986+
return;
987+
983988
*CBData = Projection;
984989
}
985990

0 commit comments

Comments
 (0)