diff --git a/lib/external/libwolv b/lib/external/libwolv index 75c669344..a74562302 160000 --- a/lib/external/libwolv +++ b/lib/external/libwolv @@ -1 +1 @@ -Subproject commit 75c66934415785597bfc089c5373fb47747d3083 +Subproject commit a745623029d36fdaafeec0f1ccb539ff815b691b diff --git a/lib/external/pattern_language b/lib/external/pattern_language index bc002793b..950a47547 160000 --- a/lib/external/pattern_language +++ b/lib/external/pattern_language @@ -1 +1 @@ -Subproject commit bc002793b0da4886f89b9bf230dff0d0226d21f3 +Subproject commit 950a47547553ff3c095c833c484547c8445bbac9 diff --git a/main/gui/source/init/run/cli.cpp b/main/gui/source/init/run/cli.cpp index 6f9797795..040f53303 100644 --- a/main/gui/source/init/run/cli.cpp +++ b/main/gui/source/init/run/cli.cpp @@ -40,16 +40,20 @@ namespace hex::init { // On Windows, argv contains UTF-16 encoded strings, so we need to convert them to UTF-8 auto convertedCommandLine = ::CommandLineToArgvW(::GetCommandLineW(), &argc); if (convertedCommandLine == nullptr) { - log::error("Failed to convert command line arguments to UTF-8"); + log::error("Failed to get command line arguments"); std::exit(EXIT_FAILURE); } // Skip the first argument (the executable path) and convert the rest to a vector of UTF-8 strings for (int i = 1; i < argc; i += 1) { std::wstring wcharArg = convertedCommandLine[i]; - std::string utf8Arg = wolv::util::wstringToUtf8(wcharArg); + auto utf8Arg = wolv::util::wstringToUtf8(wcharArg); + if (!utf8Arg.has_value()) { + log::error("Failed to convert command line arguments to UTF-8"); + std::exit(EXIT_FAILURE); + } - args.push_back(utf8Arg); + args.push_back(*utf8Arg); } ::LocalFree(convertedCommandLine); diff --git a/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_find.cpp b/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_find.cpp index 66b0faaa2..ce16d8a27 100644 --- a/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_find.cpp +++ b/plugins/builtin/source/content/popups/hex_editor/popup_hex_editor_find.cpp @@ -45,7 +45,7 @@ namespace hex::plugin::builtin { ImGui::EndTabBar(); } - if(ImGuiExt::IconHyperlink(ICON_VS_SEARCH, "hex.builtin.view.hex_editor.search.advanced"_lang)) { + if (ImGuiExt::IconHyperlink(ICON_VS_SEARCH, "hex.builtin.view.hex_editor.search.advanced"_lang)) { TaskManager::doLater([editor] { const auto& view = ContentRegistry::Views::getViewByName("hex.builtin.view.find.name"); @@ -286,25 +286,29 @@ namespace hex::plugin::builtin { } case Encoding::UTF16: { auto utf16 = wolv::util::utf8ToUtf16(s_inputString); + if (!utf16.has_value()) + return; - for (auto &c: utf16) { + for (auto &c : *utf16) { swapEndianness(c, Encoding::UTF16, m_stringEndianness); } - std::copy(reinterpret_cast(utf16.data()), - reinterpret_cast(utf16.data() + utf16.size()), + std::copy(reinterpret_cast(utf16->data()), + reinterpret_cast(utf16->data() + utf16->size()), std::back_inserter(m_searchByteSequence)); break; } case Encoding::UTF32: { auto utf32 = wolv::util::utf8ToUtf32(s_inputString); + if (!utf32.has_value()) + return; - for (auto &c: utf32) { + for (auto &c : *utf32) { swapEndianness(c, Encoding::UTF32, m_stringEndianness); } - std::copy(reinterpret_cast(utf32.data()), - reinterpret_cast(utf32.data() + utf32.size()), + std::copy(reinterpret_cast(utf32->data()), + reinterpret_cast(utf32->data() + utf32->size()), std::back_inserter(m_searchByteSequence)); break; }