From f32f079ef8c732f2eab95a10b6252f7ee4a7a227 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 19 Jan 2022 15:03:33 -0500 Subject: [PATCH] fix more crashes on the file dialog oh yes, the wonders of dealing with this useless broken file dialog. honestly I didn't think it was broken to this point... and no, I don't want to use the **other** file dialog as it requires C++17 which is too ahead of time --- extern/igfd/ImGuiFileDialog.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extern/igfd/ImGuiFileDialog.cpp b/extern/igfd/ImGuiFileDialog.cpp index 4943b97ed..06ec28f5a 100644 --- a/extern/igfd/ImGuiFileDialog.cpp +++ b/extern/igfd/ImGuiFileDialog.cpp @@ -1524,10 +1524,10 @@ namespace IGFD } #else // dirent struct dirent** files = nullptr; - size_t n = scandir(path.c_str(), &files, nullptr, inAlphaSort); - if (n) + int n = scandir(path.c_str(), &files, nullptr, inAlphaSort); + if (n>0) { - size_t i; + int i; for (i = 0; i < n; i++) { @@ -2342,13 +2342,13 @@ namespace IGFD if (puFileManager.puInputPathActivated) { auto gio = ImGui::GetIO(); - if (ImGui::IsKeyReleased(gio.KeyMap[ImGuiKey_Enter])) + if (ImGui::IsKeyReleased(ImGuiKey_Enter)) { puFileManager.SetCurrentPath(std::string(puFileManager.puInputPathBuffer)); puFileManager.OpenCurrentPath(*this); puFileManager.puInputPathActivated = false; } - if (ImGui::IsKeyReleased(gio.KeyMap[ImGuiKey_Escape])) + if (ImGui::IsKeyReleased(ImGuiKey_Escape)) { puFileManager.puInputPathActivated = false; }