From 76bfd0857ebcc7ee5196bde6d076205e022adc87 Mon Sep 17 00:00:00 2001 From: Lynix Date: Fri, 27 Jun 2014 21:16:36 +0200 Subject: [PATCH] Allowed asserts to throw exceptions instead of calling std::exit Former-commit-id: 892db922761a0a8122c60274b344c3e62de0a65f --- src/Nazara/Core/Error.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Nazara/Core/Error.cpp b/src/Nazara/Core/Error.cpp index 57e082160..e73a3e87a 100644 --- a/src/Nazara/Core/Error.cpp +++ b/src/Nazara/Core/Error.cpp @@ -44,13 +44,13 @@ void NzError::Error(nzErrorType type, const NzString& error, unsigned int line, s_lastErrorFunction = function; s_lastErrorLine = line; + if (type != nzErrorType_Warning && (s_flags & nzErrorFlag_ThrowException) != 0 && (s_flags & nzErrorFlag_ThrowExceptionDisabled) == 0) + throw std::runtime_error(error); + #if NAZARA_CORE_EXIT_ON_ASSERT_FAILURE if (type == nzErrorType_AssertFailed) std::exit(EXIT_FAILURE); #endif - - if (type != nzErrorType_Warning && (s_flags & nzErrorFlag_ThrowException) != 0 && (s_flags & nzErrorFlag_ThrowExceptionDisabled) == 0) - throw std::runtime_error(error); } nzUInt32 NzError::GetFlags()