mirror of https://github.com/WerWolv/ImHex.git
Fix crash if no magic folder is present
This commit is contained in:
parent
8172cf28db
commit
86fdd531da
|
@ -83,10 +83,13 @@ namespace hex {
|
|||
|
||||
std::string magicFiles;
|
||||
|
||||
for (const auto &entry : std::filesystem::directory_iterator("magic")) {
|
||||
std::error_code error;
|
||||
for (const auto &entry : std::filesystem::directory_iterator("magic", error)) {
|
||||
if (entry.is_regular_file() && entry.path().extension() == ".mgc")
|
||||
magicFiles += entry.path().string() + MAGIC_PATH_SEPARATOR;
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
magicFiles.pop_back();
|
||||
|
||||
{
|
||||
|
@ -114,6 +117,8 @@ namespace hex {
|
|||
magic_close(cookie);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
this->m_shouldInvalidate = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue