2
0
Эх сурвалжийг харах

DrawList: made AddCallback() assert when passing a null callback.

ocornut 1 өдөр өмнө
parent
commit
ea8a5a9e17

+ 1 - 0
docs/CHANGELOG.txt

@@ -71,6 +71,7 @@ Other Changes:
   unmoved. We revert back to move to the end of line in this situation.
   unmoved. We revert back to move to the end of line in this situation.
 - DrawList: fixed CloneOutput() unnecessarily taking a copy of the ImDrawListSharedData
 - DrawList: fixed CloneOutput() unnecessarily taking a copy of the ImDrawListSharedData
   pointer, which could to issue when deleting the cloned list. (#8894, #1860)
   pointer, which could to issue when deleting the cloned list. (#8894, #1860)
+- DrawList: made AddCallback() assert when passing a null callback.
 - Debug Tools: ID Stack Tool: fixed using fixed-size buffers preventing long identifiers
 - Debug Tools: ID Stack Tool: fixed using fixed-size buffers preventing long identifiers
   from being displayed in the tool. (#8905, #4631)
   from being displayed in the tool. (#8905, #4631)
 - Debug Tools: ID Stack Tool: when ### is used, uncontributing prefix before the ###
 - Debug Tools: ID Stack Tool: when ### is used, uncontributing prefix before the ###

+ 1 - 0
imgui_draw.cpp

@@ -518,6 +518,7 @@ void ImDrawList::AddCallback(ImDrawCallback callback, void* userdata, size_t use
 {
 {
     IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
     IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
     ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
     ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
+    IM_ASSERT(callback != NULL);
     IM_ASSERT(curr_cmd->UserCallback == NULL);
     IM_ASSERT(curr_cmd->UserCallback == NULL);
     if (curr_cmd->ElemCount != 0)
     if (curr_cmd->ElemCount != 0)
     {
     {