From 24c826e5b109faff843179c3ee41fc8a5f21eb2b Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 12 Oct 2014 19:43:19 -0700 Subject: [PATCH] Don't log everything to the log handler when that log level is disabled --- src/gba/gba.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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");