diff Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 3039:0293cb3d8a37

fix for msvc
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 Dec 2018 09:26:09 +0100
parents ff65c925f57a
children 4e43e67f8ecf
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Wed Dec 19 14:35:55 2018 +0100
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp	Thu Dec 20 09:26:09 2018 +0100
@@ -211,13 +211,18 @@
 
     std::vector<const char*> headersKeys;
     std::vector<const char*> headersValues;
-    for (std::map<std::string, std::string>::const_iterator it = httpHeaders.begin(); it != httpHeaders.end(); it++)
+    
+    for (std::map<std::string, std::string>::const_iterator
+           it = httpHeaders.begin(); it != httpHeaders.end(); it++)
     {
       headersKeys.push_back(it->first.c_str());
       headersValues.push_back(it->second.c_str());
     }
 
-    return CheckHttp(OrthancPluginRestApiGet2(GetGlobalContext(), &buffer_, uri.c_str(), httpHeaders.size(), headersKeys.data(), headersValues.data(), applyPlugins));
+    return CheckHttp(OrthancPluginRestApiGet2(
+                       GetGlobalContext(), &buffer_, uri.c_str(), httpHeaders.size(),
+                       (headersKeys.empty() ? NULL : &headersKeys[0]),
+                       (headersValues.empty() ? NULL : &headersValues[0]), applyPlugins));
   }
 
   bool MemoryBuffer::RestApiPost(const std::string& uri,