Fix debugging shim to work even if there is no GBA struct at the moment

This commit is contained in:
Jeffrey Pfau 2014-02-01 16:27:27 -08:00
parent b9f8955890
commit 69d188668d
1 changed files with 5 additions and 2 deletions

View File

@ -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);
}