From a96ae9bbc7c0e9cf09bfdf921403922bcd3aa0de Mon Sep 17 00:00:00 2001 From: Matt <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 15 Aug 2025 13:09:39 +0300 Subject: [PATCH] Use debug break rather than a null dereference (#24931) * Use debug break rather than a null dereference * Silence clang-tidy --- src/openrct2/core/Guard.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/openrct2/core/Guard.cpp b/src/openrct2/core/Guard.cpp index aef1762171..dc318c885a 100644 --- a/src/openrct2/core/Guard.cpp +++ b/src/openrct2/core/Guard.cpp @@ -12,6 +12,18 @@ #include #endif +// NOLINTBEGIN +#if defined(_MSC_VER) + #include + #define debug_break() __debugbreak() +#elif defined(__GNUC__) || defined(__clang__) + #define debug_break() __builtin_trap() +#else + #include + #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