changeset 1427:cecedf0b1be6

fix for msvc2008
author s.jodogne@gmail.com
date Fri, 15 May 2020 14:15:14 +0200
parents 1e132fe7090e
children da411df009bd
files Samples/Common/RtViewerApp.cpp Samples/Common/RtViewerApp.h Samples/Sdl/RtViewer/RtViewerSdl.cpp
diffstat 3 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Samples/Common/RtViewerApp.cpp	Fri May 15 13:04:34 2020 +0200
+++ b/Samples/Common/RtViewerApp.cpp	Fri May 15 14:15:14 2020 +0200
@@ -227,10 +227,17 @@
       arguments_[key] = value;
   }
 
-  const std::string& RtViewerApp::GetArgument(const std::string& key) const
+  std::string RtViewerApp::GetArgument(const std::string& key) const
   {
-    ORTHANC_ASSERT(HasArgument(key));
-    return arguments_.at(key);
+    std::map<std::string, std::string>::const_iterator found = arguments_.find(key);
+    if (found == arguments_.end())
+    {
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
+    }
+    else
+    {
+      return found->second;
+    }
   }
 
   bool RtViewerApp::HasArgument(const std::string& key) const
--- a/Samples/Common/RtViewerApp.h	Fri May 15 13:04:34 2020 +0200
+++ b/Samples/Common/RtViewerApp.h	Fri May 15 14:15:14 2020 +0200
@@ -109,7 +109,7 @@
     // SetArgument is above (public section)
     std::map<std::string, std::string> arguments_;
 
-    const std::string& GetArgument(const std::string& key) const;
+    std::string GetArgument(const std::string& key) const;
     bool HasArgument(const std::string& key) const;
 
     /**
--- a/Samples/Sdl/RtViewer/RtViewerSdl.cpp	Fri May 15 13:04:34 2020 +0200
+++ b/Samples/Sdl/RtViewer/RtViewerSdl.cpp	Fri May 15 14:15:14 2020 +0200
@@ -222,7 +222,7 @@
       if (windowID == curWindowID)
         return view;
     }
-    return NULL;
+    return boost::shared_ptr<OrthancStone::RtViewerView>();
   }
 
   void RtViewerApp::SdlRunLoop(const std::vector<boost::shared_ptr<OrthancStone::RtViewerView> >& views,