[API] Fix nHasDragDropPayload SIGSEGV when payload doesn't exist (#155)

`getDragDropPayload()` functions should simply return null when
the payload doesn't exist.

Currently, DearImGui will return NULL from `ImGui::GetDragDropPayload()`
when the payload does not exist. This causes a null dereference
since the nHasDragDropPayload function performs no NULL check
This commit is contained in:
Moulberry authored and GitHub committed 2023-02-03 19:11:47 +02:00
1 parent 4f06b4e0de
commit 667d6108b8
1 file changed
+4 -2
+4 -2
View File
@@ -5118,11 +5118,13 @@ public class ImGui {
}
private static native boolean nHasDragDropPayload(); /*
return ImGui::GetDragDropPayload()->Data != NULL;
const ImGuiPayload* payload = ImGui::GetDragDropPayload();
return payload != NULL && payload->Data != NULL;
*/
private static native boolean nHasDragDropPayload(String dataType); /*
return ImGui::GetDragDropPayload()->IsDataType(dataType);
const ImGuiPayload* payload = ImGui::GetDragDropPayload();
return payload != NULL && payload->IsDataType(dataType);
*/
/**