From beb56dd72f8a77f6b37da4e1cde0e992de59fd98 Mon Sep 17 00:00:00 2001 From: Date: Tue, 28 Jun 2016 01:45:54 -0400 Subject: [PATCH] [Common] Evade null pointer exception while tracing pre-AppInit(). --- Source/Common/path.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/Common/path.cpp b/Source/Common/path.cpp index 5b3682c5c..a5d49a5db 100644 --- a/Source/Common/path.cpp +++ b/Source/Common/path.cpp @@ -12,6 +12,17 @@ #endif #include "Platform.h" +/* + * g_ModuleLogLevel may be NULL while AppInit() is still in session in path.cpp. + * The added check to compare to NULL here is at least a temporary workaround. + */ +#undef WriteTrace +#ifdef _WIN32 +#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != NULL && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __FUNCTION__, (format), ## __VA_ARGS__); } +#else +#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != NULL && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __PRETTY_FUNCTION__, (format), ## __VA_ARGS__); } +#endif + ////////////////////////////////////////////////////////////////////// // Constants //////////////////////////////////////////////////////////////////////