Skip to content

Commit

Permalink
[Common] Evade null pointer exception while tracing pre-AppInit().
Browse files Browse the repository at this point in the history
  • Loading branch information
cxd4 committed Jun 28, 2016
1 parent 46c6a6b commit beb56dd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Source/Common/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit beb56dd

Please sign in to comment.