1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 04:23:20 +01:00

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
2025-08-15 13:09:39 +03:00
committed by GitHub
parent 7130486e65
commit a96ae9bbc7

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