summarylogtreecommitdiffstats
path: root/0001-Fix-crash-on-pattern-load-319.patch
blob: 0abbcb49f6efeb4f49e2cff4369b3632e330a1be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 655a1d4f170fff1689ac3dcdbda6c79ff1c85409 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Anton=20=C3=84lgmyr?= <anton@algmyr.se>
Date: Sat, 9 Oct 2021 17:08:45 +0200
Subject: [PATCH 1/3] 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 2608679..734b94f 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());
@@ -417,4 +419,4 @@ namespace hex {
 
     }
 
-}
\ No newline at end of file
+}
-- 
2.33.1