From 21769886fc72da3e1c5440a2052490b3528ac892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20=C3=84lgmyr?= Date: Sat, 9 Oct 2021 17:08:45 +0200 Subject: [PATCH] Fix crash on pattern load (#319) --- source/views/view_pattern_editor.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/views/view_pattern_editor.cpp b/source/views/view_pattern_editor.cpp index 7526c848e..ff39d7552 100644 --- a/source/views/view_pattern_editor.cpp +++ b/source/views/view_pattern_editor.cpp @@ -191,6 +191,8 @@ namespace hex { this->m_possiblePatternFiles.clear(); for (auto &imhexPath : hex::getPath(ImHexPath::Patterns)) { + if (!fs::exists(imhexPath)) continue; + for (auto &entry: fs::recursive_directory_iterator(imhexPath)) { if (entry.is_regular_file() && entry.path().extension() == ".hexpat") { this->m_possiblePatternFiles.push_back(entry.path()); @@ -430,4 +432,4 @@ namespace hex { } -} \ No newline at end of file +}