]> granicus.if.org Git - icinga2/commitdiff
Fix crash in DiagnosticInformation().
authorGunnar Beutner <gunnar@beutner.name>
Sat, 29 Mar 2014 22:02:55 +0000 (23:02 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sun, 30 Mar 2014 00:20:57 +0000 (01:20 +0100)
Refs #5870

lib/base/exception.h

index 872f69fd4e268f1e100174fb38bf17e27626ac41..79783c5e7882d3bcd9fa53a37f7b50284e5d2d0f 100644 (file)
@@ -61,19 +61,22 @@ String DiagnosticInformation(const T& ex, StackTrace *stack = NULL, ContextTrace
                if (boost::get_error_info<StackTraceErrorInfo>(ex) == NULL) {
                        result << std::endl;
 
+                       if (!stack)
+                               stack = GetLastExceptionStack();
+                       
                        if (stack)
                                result << *stack;
-                       else
-                               result << *GetLastExceptionStack();
+                               
                }
 
                if (boost::get_error_info<ContextTraceErrorInfo>(ex) == NULL) {
                        result << std::endl;
 
+                       if (!context)
+                               context = GetLastExceptionContext();
+
                        if (context)
                                result << *context;
-                       else
-                               result << *GetLastExceptionContext();
                }
        }