mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
fix: Crash when saving a new file to disk
This commit is contained in:
@@ -60,12 +60,15 @@ namespace hex::plugin::builtin {
|
||||
auto &runtime = ContentRegistry::PatternLanguage::getRuntime();
|
||||
|
||||
const auto height = std::max(ImGui::GetContentRegionAvail().y - ImGui::GetTextLineHeightWithSpacing() - ImGui::GetStyle().FramePadding.y * 2, ImGui::GetTextLineHeightWithSpacing() * 5);
|
||||
if (!runtime.arePatternsValid()) {
|
||||
(*m_patternDrawer)->draw({ }, nullptr, height);
|
||||
} else {
|
||||
// If the runtime has finished evaluating, draw the patterns
|
||||
if (TRY_LOCK(ContentRegistry::PatternLanguage::getRuntimeLock())) {
|
||||
(*m_patternDrawer)->draw(runtime.getPatterns(), &runtime, height);
|
||||
|
||||
if (*m_patternDrawer != nullptr) {
|
||||
if (!runtime.arePatternsValid()) {
|
||||
(*m_patternDrawer)->draw({ }, nullptr, height);
|
||||
} else {
|
||||
// If the runtime has finished evaluating, draw the patterns
|
||||
if (TRY_LOCK(ContentRegistry::PatternLanguage::getRuntimeLock())) {
|
||||
(*m_patternDrawer)->draw(runtime.getPatterns(), &runtime, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user