aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Nash <george.nash@intel.com>2017-07-27 14:59:36 -0700
committerGeorge Nash <george.nash@intel.com>2017-07-27 15:02:26 -0700
commita90800814aeeff8bc9df7f679208c1ddbf843f0a (patch)
treef755a518fa8faa9dd17c68ce2931ab3540da665f
parent26198fc259475fb5187601429e971f9bb57e644e (diff)
Fixed build issue for in UpnpGenericService
The code was checking if a std::string==nullptr although this is an invalid check older compilers seemed to allow the check. The null check was removed, and when obtaining the value from the map is checked to make sure its indeed contains the value in the map. Change-Id: Ie67527c91d9c138e579179cd791c867bfa15c488 Signed-off-by: George Nash <george.nash@intel.com>
-rw-r--r--plugins/upnp_plugin/UpnpGenericService.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/upnp_plugin/UpnpGenericService.cpp b/plugins/upnp_plugin/UpnpGenericService.cpp
index cfa299b..768b450 100644
--- a/plugins/upnp_plugin/UpnpGenericService.cpp
+++ b/plugins/upnp_plugin/UpnpGenericService.cpp
@@ -78,8 +78,11 @@ OCEntityHandlerResult UpnpGenericService::processGetRequest(string uri, OCRepPay
{
const GType type = stateVarInfo->type;
const string gType = g_type_name(type);
- argType = GTypeToUpnpTypeMap[gType];
- if ((argType == nullptr) || (argType.empty()))
+ if (GTypeToUpnpTypeMap.end() != GTypeToUpnpTypeMap.find(gType))
+ {
+ argType = GTypeToUpnpTypeMap[gType];
+ }
+ if (argType.empty())
{
ERROR_PRINT("No type found for GType " << gType);
}
@@ -183,8 +186,12 @@ OCEntityHandlerResult UpnpGenericService::processGetRequest(string uri, OCRepPay
const GType type = stateVarInfo->type;
const string gType = g_type_name(type);
- const string upnpType = GTypeToUpnpTypeMap[gType];
- if ((upnpType != nullptr) && (! upnpType.empty()))
+ string upnpType;
+ if (GTypeToUpnpTypeMap.end() != GTypeToUpnpTypeMap.find(gType))
+ {
+ upnpType = GTypeToUpnpTypeMap[gType];
+ }
+ if (!upnpType.empty())
{
if (OCRepPayloadSetPropString(payload, DATA_TYPE.c_str(), upnpType.c_str()))
{