diff OrthancServer/ServerContext.cpp @ 2134:ddc75c6c712d

Avoid hard crash if not enough memory
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 12:04:09 +0100
parents 9329ba17a069
children cadfe0a2a393
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp	Wed Nov 09 10:21:37 2016 +0100
+++ b/OrthancServer/ServerContext.cpp	Wed Nov 09 12:04:09 2016 +0100
@@ -86,7 +86,18 @@
         {
           try
           {
-            it->GetListener().SignalChange(change);
+            try
+            {
+              it->GetListener().SignalChange(change);
+            }
+            catch (std::bad_alloc&)
+            {
+              LOG(ERROR) << "Not enough memory while signaling a change";
+            }
+            catch (...)
+            {
+              throw OrthancException(ErrorCode_InternalError);
+            }
           }
           catch (OrthancException& e)
           {