changeset 3039:0293cb3d8a37

fix for msvc
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 Dec 2018 09:26:09 +0100
parents 3254b36a5f9b
children 07ab06af90ed
files Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
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,