fix: Crash when searching for an empty string

This commit is contained in:
WerWolv 2022-07-16 13:01:40 +02:00
parent 0d3eaa5d86
commit 0c9eab70d5
1 changed files with 8 additions and 5 deletions

View File

@ -5,7 +5,6 @@
#include <hex/helpers/utils.hpp>
#include <hex/providers/buffered_reader.hpp>
#include <hex/helpers/crypto.hpp>
#include <hex/helpers/logger.hpp>
#include "math_evaluator.hpp"
@ -105,8 +104,10 @@ namespace hex::plugin::builtin {
if (ImGui::BeginTabBar("##find_tabs")) {
if (ImGui::BeginTabItem("hex.builtin.view.hex_editor.search.hex"_lang)) {
if (ImGui::InputText("##input", this->m_input, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_CharsHexadecimal)) {
this->m_shouldSearch = true;
this->m_backwards = false;
if (!this->m_input.empty()) {
this->m_shouldSearch = true;
this->m_backwards = false;
}
}
this->drawButtons();
@ -120,8 +121,10 @@ namespace hex::plugin::builtin {
if (ImGui::BeginTabItem("hex.builtin.view.hex_editor.search.string"_lang)) {
if (ImGui::InputText("##input", this->m_input, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll)) {
this->m_shouldSearch = true;
this->m_backwards = false;
if (!this->m_input.empty()) {
this->m_shouldSearch = true;
this->m_backwards = false;
}
}
this->drawButtons();