diff --git a/CHANGES b/CHANGES index d0ae4f3d5..1a344d2cd 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,7 @@ Bugfixes: - GB Core: Fix palette loading when loading a foreign config - Qt: Fix LOG argument order - GB Memory: Prevent accessing empty SRAM (fixes mgba.io/i/831) + - GB, GBA: Fix crashes when attempting to identify null VFiles Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722) diff --git a/src/gb/gb.c b/src/gb/gb.c index 0ef8bb051..79d438df6 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -658,6 +658,9 @@ void GBIllegal(struct LR35902Core* cpu) { } bool GBIsROM(struct VFile* vf) { + if (!vf) { + return false; + } vf->seek(vf, 0x104, SEEK_SET); uint8_t header[4]; diff --git a/src/gba/gba.c b/src/gba/gba.c index 3baaea232..836e0dede 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -527,6 +527,9 @@ bool GBAIsROM(struct VFile* vf) { return isGBA; } #endif + if (!vf) { + return false; + } if (vf->seek(vf, GBA_ROM_MAGIC_OFFSET, SEEK_SET) < 0) { return false; }