From 69d188668d45e21f71bea3f4694501b86716d628 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 1 Feb 2014 16:27:27 -0800 Subject: [PATCH] Fix debugging shim to work even if there is no GBA struct at the moment --- src/gba/gba.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gba/gba.c b/src/gba/gba.c index fd2545c2a..a6b29c2e5 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -536,7 +536,10 @@ void GBALog(struct GBA* gba, enum GBALogLevel level, const char* format, ...) { } void GBADebuggerLogShim(struct ARMDebugger* debugger, enum DebuggerLogLevel level, const char* format, ...) { - struct GBABoard* gbaBoard = (struct GBABoard*) debugger->cpu->board; + struct GBABoard* gbaBoard = 0; + if (debugger->cpu && debugger->cpu->board) { + gbaBoard = (struct GBABoard*) debugger->cpu->board; + } enum GBALogLevel gbaLevel; switch (level) { @@ -555,7 +558,7 @@ void GBADebuggerLogShim(struct ARMDebugger* debugger, enum DebuggerLogLevel leve } va_list args; va_start(args, format); - _GBAVLog(gbaBoard->p, gbaLevel, format, args); + _GBAVLog(gbaBoard ? gbaBoard->p : 0, gbaLevel, format, args); va_end(args); }