GB, GBA: Fix crashes when attempting to identify null VFiles

This commit is contained in:
Vicki Pfau 2017-07-29 17:32:36 -07:00
parent e1bc79b837
commit 5c90abd294
3 changed files with 7 additions and 0 deletions

View File

@ -17,6 +17,7 @@ Bugfixes:
- GB Core: Fix palette loading when loading a foreign config - GB Core: Fix palette loading when loading a foreign config
- Qt: Fix LOG argument order - Qt: Fix LOG argument order
- GB Memory: Prevent accessing empty SRAM (fixes mgba.io/i/831) - GB Memory: Prevent accessing empty SRAM (fixes mgba.io/i/831)
- GB, GBA: Fix crashes when attempting to identify null VFiles
Misc: Misc:
- GBA Timer: Use global cycles for timers - GBA Timer: Use global cycles for timers
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722) - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)

View File

@ -658,6 +658,9 @@ void GBIllegal(struct LR35902Core* cpu) {
} }
bool GBIsROM(struct VFile* vf) { bool GBIsROM(struct VFile* vf) {
if (!vf) {
return false;
}
vf->seek(vf, 0x104, SEEK_SET); vf->seek(vf, 0x104, SEEK_SET);
uint8_t header[4]; uint8_t header[4];

View File

@ -527,6 +527,9 @@ bool GBAIsROM(struct VFile* vf) {
return isGBA; return isGBA;
} }
#endif #endif
if (!vf) {
return false;
}
if (vf->seek(vf, GBA_ROM_MAGIC_OFFSET, SEEK_SET) < 0) { if (vf->seek(vf, GBA_ROM_MAGIC_OFFSET, SEEK_SET) < 0) {
return false; return false;
} }