mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
fix(util): SFile::Open() should set to nullptr even in the case of a failure
This commit is contained in:
parent
1be8d5539c
commit
6a06eb16e7
1 changed files with 2 additions and 0 deletions
|
|
@ -125,6 +125,7 @@ int32_t SFile::OpenEx(SArchive* archive, const char* filename, uint32_t flags, S
|
||||||
|
|
||||||
// Overflow protection
|
// Overflow protection
|
||||||
if (SStrLen(filename) + 1 > STORM_MAX_PATH) {
|
if (SStrLen(filename) + 1 > STORM_MAX_PATH) {
|
||||||
|
*file = nullptr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,6 +147,7 @@ int32_t SFile::OpenEx(SArchive* archive, const char* filename, uint32_t flags, S
|
||||||
filetype = SFILE_PAQ;
|
filetype = SFILE_PAQ;
|
||||||
filehandle = static_cast<void*>(handle);
|
filehandle = static_cast<void*>(handle);
|
||||||
} else {
|
} else {
|
||||||
|
*file = nullptr;
|
||||||
// could not open either plain or MPQ archived file
|
// could not open either plain or MPQ archived file
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue