Use debug break rather than a null dereference (#24931)

* Use debug break rather than a null dereference

* Silence clang-tidy
This commit is contained in:
Matt authored and GitHub committed 2025-08-15 12:09:39 +02:00
1 parent 7130486e65
commit a96ae9bbc7
1 file changed
+13 -6
+13 -6
View File
@@ -12,6 +12,18 @@
#include <windows.h>
#endif
// NOLINTBEGIN
#if defined(_MSC_VER)
#include <intrin.h>
#define debug_break() __debugbreak()
#elif defined(__GNUC__) || defined(__clang__)
#define debug_break() __builtin_trap()
#else
#include <signal.h>
#define debug_break() raise(SIGTRAP)
#endif
// NOLINTEND
#include "../Version.h"
#include "Console.hpp"
#include "Diagnostics.hpp"
@@ -158,12 +170,7 @@ namespace OpenRCT2::Guard
static void ForceCrash()
{
#ifdef USE_BREAKPAD
// Force a crash that breakpad will handle allowing us to get a dump
*((void**)0) = 0;
#else
assert(false);
#endif
debug_break();
}
#endif
} // namespace OpenRCT2::Guard