diff --git a/lib/libimhex/source/helpers/file.cpp b/lib/libimhex/source/helpers/file.cpp index 8dc276979..84939b015 100644 --- a/lib/libimhex/source/helpers/file.cpp +++ b/lib/libimhex/source/helpers/file.cpp @@ -103,9 +103,12 @@ namespace hex { auto startPos = ftello64(this->m_file); fseeko64(this->m_file, 0, SEEK_END); - size_t size = ftello64(this->m_file); + auto size = ftello64(this->m_file); fseeko64(this->m_file, startPos, SEEK_SET); + if (size < 0) + return 0; + return size; }