From 9f6d13f4c3803506163b4c0f549993da2052f226 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Tue, 17 Sep 2013 14:45:37 +0200 Subject: [PATCH] Fixes coverity issue --- Plugins/ViaRoutePlugin.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Plugins/ViaRoutePlugin.h b/Plugins/ViaRoutePlugin.h index 381b370a9..5233104b6 100644 --- a/Plugins/ViaRoutePlugin.h +++ b/Plugins/ViaRoutePlugin.h @@ -24,7 +24,6 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "BasePlugin.h" #include "../Algorithms/ObjectToBase64.h" -#include "../DataStructures/HashTable.h" #include "../DataStructures/QueryEdge.h" #include "../DataStructures/StaticGraph.h" #include "../DataStructures/SearchEngine.h" @@ -35,6 +34,8 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "../Util/SimpleLogger.h" #include "../Util/StringUtil.h" +#include + #include #include @@ -58,9 +59,9 @@ public: searchEnginePtr = new SearchEngine(objects); - descriptorTable.insert(std::make_pair("" , 0)); - descriptorTable.insert(std::make_pair("json", 0)); - descriptorTable.insert(std::make_pair("gpx" , 1)); + // descriptorTable.emplace("" , 0); + descriptorTable.emplace("json", 0); + descriptorTable.emplace("gpx" , 1); } virtual ~ViaRoutePlugin() { @@ -129,7 +130,12 @@ public: } _DescriptorConfig descriptorConfig; - unsigned descriptorType = descriptorTable[routeParameters.outputFormat]; + + unsigned descriptorType = 0; + if(descriptorTable.find(routeParameters.outputFormat) != descriptorTable.end() ) { + descriptorType = descriptorTable.find(routeParameters.outputFormat)->second; + } + descriptorTable[routeParameters.outputFormat]; descriptorConfig.z = routeParameters.zoomLevel; descriptorConfig.instructions = routeParameters.printInstructions; descriptorConfig.geometry = routeParameters.geometry;