[MediaController] Added check for nullptr.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Tue, 9 Jun 2015 08:11:33 +0000 (10:11 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Tue, 9 Jun 2015 08:11:33 +0000 (10:11 +0200)
Prevent CID: 389014

[Verification] Code compiles.

Change-Id: I107264ca2067a100183029add8eca1eee4d8fe86
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/mediacontroller/mediacontroller_types.cc

index fae55e1b6a2824601d223329365f0db9d5655884..b6c194cb81f26cb2679fe2f95d3cc17a8fc4e819 100755 (executable)
@@ -211,11 +211,8 @@ PlatformResult Types::ConvertMetadata(mc_metadata_h metadata_h,
       return PlatformResult(ErrorCode::UNKNOWN_ERR,
                             "Error getting metadata");
     }
-    if (NULL == value) {
-      value = strdup("");
-    }
 
-    (*metadata)[field.first] = picojson::value(std::string(value));
+    (*metadata)[field.first] = picojson::value(std::string(value ? value : ""));
   }
 
   return PlatformResult(ErrorCode::NO_ERROR);