From e8206db829f7c5d9a07985a2e2a8de6769cac64d Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 2 Apr 2023 17:29:11 +0200 Subject: [PATCH] InputText: Fixed crash introduced by 5a2b1e848 (#6292, #4714) --- imgui.h | 2 +- imgui_widgets.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.h b/imgui.h index a90a4dc9..2c607f86 100644 --- a/imgui.h +++ b/imgui.h @@ -23,7 +23,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345') #define IMGUI_VERSION "1.89.5 WIP" -#define IMGUI_VERSION_NUM 18946 +#define IMGUI_VERSION_NUM 18947 #define IMGUI_HAS_TABLE /* diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index eb28738d..a80fe0a6 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4036,7 +4036,7 @@ void ImGui::InputTextDeactivateHook(ImGuiID id) return; g.InputTextDeactivatedState.ID = state->ID; g.InputTextDeactivatedState.TextA.resize(state->CurLenA + 1); - memcpy(g.InputTextDeactivatedState.TextA.Data, state->TextA.Data, state->CurLenA + 1); + memcpy(g.InputTextDeactivatedState.TextA.Data, state->TextA.Data ? state->TextA.Data : "", state->CurLenA + 1); } // Edit a string of text