mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
fix: Crash when opening a file that cannot be mapped into memory
This commit is contained in:
@@ -232,7 +232,11 @@ namespace hex::plugin::builtin {
|
||||
m_fileStats = file.getFileInfo();
|
||||
m_file = std::move(file);
|
||||
|
||||
m_file.map();
|
||||
if (!m_file.map()) {
|
||||
this->setErrorMessage(hex::format("hex.builtin.provider.file.error.open"_lang, m_path.string(), ::strerror(errno)));
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fileSize = m_file.getSize();
|
||||
|
||||
m_file.close();
|
||||
|
||||
Reference in New Issue
Block a user