diff --git a/src/gba/gba.c b/src/gba/gba.c index 761181938..745ee5ac9 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -554,16 +554,17 @@ static void _GBAVLog(struct GBA* gba, enum GBALogLevel level, const char* format if (!gba) { gba = threadContext->gba; } - if (threadContext->logHandler) { - threadContext->logHandler(threadContext, level, format, args); - return; - } } if (gba && !(level & gba->logLevel) && level != GBA_LOG_FATAL) { return; } + if (threadContext && threadContext->logHandler) { + threadContext->logHandler(threadContext, level, format, args); + return; + } + vprintf(format, args); printf("\n");