1
0
mirror of synced 2024-11-13 18:50:53 +01:00

fix: Crash when opening invalid files through the CLI

This commit is contained in:
WerWolv 2023-10-16 10:59:17 +02:00
parent 93c8a45de0
commit afceb34729

View File

@ -75,8 +75,12 @@ namespace hex::plugin::builtin {
if (arg == "--" && !doubleDashFound) {
doubleDashFound = true;
} else {
auto path = std::filesystem::weakly_canonical(arg);
fullPaths.push_back(wolv::util::toUTF8String(path));
try {
auto path = std::filesystem::weakly_canonical(arg);
fullPaths.push_back(wolv::util::toUTF8String(path));
} catch (std::exception &e) {
log::error("Failed to open file '{}'\n {}", arg, e.what());
}
}
}