mirror of https://github.com/mgba-emu/mgba.git
GB: Fix potential null pointer deref
This commit is contained in:
parent
dfab801277
commit
cd22c140f0
|
@ -1119,11 +1119,11 @@ bool GBIsROM(struct VFile* vf) {
|
||||||
|
|
||||||
void GBGetGameInfo(const struct GB* gb, struct mGameInfo* info) {
|
void GBGetGameInfo(const struct GB* gb, struct mGameInfo* info) {
|
||||||
memset(info, 0, sizeof(*info));
|
memset(info, 0, sizeof(*info));
|
||||||
const struct GBCartridge* cart = NULL;
|
if (!gb->memory.rom) {
|
||||||
if (gb->memory.rom) {
|
return;
|
||||||
cart = (const struct GBCartridge*) &gb->memory.rom[0x100];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const struct GBCartridge* cart = (const struct GBCartridge*) &gb->memory.rom[0x100];
|
||||||
if (cart->cgb == 0xC0) {
|
if (cart->cgb == 0xC0) {
|
||||||
strlcpy(info->system, "CGB", sizeof(info->system));
|
strlcpy(info->system, "CGB", sizeof(info->system));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue