Skip to content

Commit 5c0c283

Browse files
committed
Addendum to 651cea5
1 parent e75b073 commit 5c0c283

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

Client/core/CrashHandler.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -708,31 +708,21 @@ void __cdecl AbortSignalHandler([[maybe_unused]] int signal) noexcept
708708
CONTEXT* pCtx = nullptr;
709709
EXCEPTION_POINTERS exPtrs{};
710710

711-
if (BuildExceptionContext(exPtrs, pExRecord, pCtx, EXCEPTION_NONCONTINUABLE_EXCEPTION))
711+
PFNCHFILTFN callback = g_pfnCrashCallback.load(std::memory_order_acquire);
712+
713+
if (callback != nullptr && BuildExceptionContext(exPtrs, pExRecord, pCtx, EXCEPTION_NONCONTINUABLE_EXCEPTION))
712714
{
713-
PFNCHFILTFN callback = g_pfnCrashCallback.load(std::memory_order_acquire);
714-
if (callback != nullptr)
715-
{
716-
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Calling crash handler callback");
715+
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Calling crash handler callback");
717716

718-
try
719-
{
720-
callback(&exPtrs);
721-
}
722-
catch (...)
723-
{
724-
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Exception in crash handler callback");
725-
}
717+
try
718+
{
719+
callback(&exPtrs);
726720
}
727-
else
721+
catch (...)
728722
{
729-
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "No crash handler callback available");
723+
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Exception in crash handler callback");
730724
}
731725
}
732-
else
733-
{
734-
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Failed to allocate exception structures");
735-
}
736726

737727
if (pCtx != nullptr)
738728
{
@@ -1346,7 +1336,7 @@ static bool BuildExceptionContext(EXCEPTION_POINTERS& outExPtrs, EXCEPTION_RECOR
13461336

13471337
PFNCHFILTFN callback = g_pfnCrashCallback.load(std::memory_order_acquire);
13481338

1349-
if (BuildExceptionContext(exPtrs, pExRecord, pCtx, CPP_EXCEPTION_CODE) && callback != nullptr)
1339+
if (callback != nullptr && BuildExceptionContext(exPtrs, pExRecord, pCtx, CPP_EXCEPTION_CODE))
13501340
{
13511341
SafeDebugOutput(DEBUG_PREFIX_CPP "Calling crash handler callback\n");
13521342

0 commit comments

Comments
 (0)