Skip to content

Commit a316c10

Browse files
committed
bugfix(system): Add defensive check in extractCrashLocation for empty strings
Add null and empty string checks after calling g_LastErrorDump.str() to handle cases where isEmpty() doesn't work reliably across different build configurations and STL implementations. Issue discovered in testing: Location field showed different values across builds when calling ReleaseCrash() without exception context: - Win32 Release: Empty (correct) - VC6 Release: Shows 'T' (incorrect - isEmpty() failed) - Win32 Debug: Shows corrupted data (incorrect - isEmpty() failed) The additional check ensures consistent behavior across all builds. This doesn't affect real crashes - exceptions always populate g_LastErrorDump through DumpExceptionInfo() which properly clears and fills the string. Relates to TheSuperHackers#2069
1 parent 81bc3fd commit a316c10

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • Core/GameEngine/Source/Common/System

Core/GameEngine/Source/Common/System/Debug.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,13 @@ static void extractCrashLocation(char* outBuffer, size_t bufferSize)
757757

758758
const char* stackStr = g_LastErrorDump.str();
759759

760+
// TheSuperHackers @bugfix JohnsterID 12/01/2026 Defensive check for null or empty string
761+
// isEmpty() check above doesn't work reliably across all build configs (VC6/STLPort vs Win32).
762+
// This ensures consistent behavior when ReleaseCrash called without exception context.
763+
if (!stackStr || !*stackStr) {
764+
return;
765+
}
766+
760767
// Skip leading whitespace/newlines
761768
while (*stackStr && isspace(static_cast<unsigned char>(*stackStr))) {
762769
stackStr++;

0 commit comments

Comments
 (0)