瀏覽代碼

InputText: Fixed crash introduced by 5a2b1e848 (#6292, #4714)

ocornut 2 年之前
父節點
當前提交
e8206db829
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      imgui.h
  2. 1 1
      imgui_widgets.cpp

+ 1 - 1
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
 
 /*

+ 1 - 1
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