mirror of https://github.com/WerWolv/ImHex.git
Fixed possible crash when loading files, relax pattern detection requirements
This fixes #20
This commit is contained in:
parent
7b8330f8f8
commit
68f93c5e3d
|
@ -95,7 +95,7 @@ namespace hex {
|
|||
});
|
||||
|
||||
View::subscribeEvent(Events::FileLoaded, [this](const void* userData) {
|
||||
if (!this->m_textEditor.GetText().empty())
|
||||
if (this->m_textEditor.GetText().find_first_not_of(" \f\n\r\t\v") != std::string::npos)
|
||||
return;
|
||||
|
||||
lang::Preprocessor preprocessor;
|
||||
|
@ -107,6 +107,9 @@ namespace hex {
|
|||
magicFiles += entry.path().string() + MAGIC_PATH_SEPARATOR;
|
||||
}
|
||||
|
||||
if (error)
|
||||
return;
|
||||
|
||||
std::vector<u8> buffer(std::min(this->m_dataProvider->getSize(), size_t(0xFFFF)), 0x00);
|
||||
this->m_dataProvider->read(0, buffer.data(), buffer.size());
|
||||
|
||||
|
@ -151,7 +154,7 @@ namespace hex {
|
|||
|
||||
if (foundCorrectType) {
|
||||
this->m_possiblePatternFile = entry.path();
|
||||
ImGui::OpenPopup("Accept Pattern");
|
||||
View::doLater([] { ImGui::OpenPopup("Accept Pattern"); });
|
||||
ImGui::SetNextWindowSize(ImVec2(200, 100));
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue