Prevent fix
authorSunwook Bae <sunwook45.bae@samsung.com>
Fri, 12 Apr 2013 00:34:59 +0000 (09:34 +0900)
committerSunwook Bae <sunwook45.bae@samsung.com>
Fri, 12 Apr 2013 00:34:59 +0000 (09:34 +0900)
Change-Id: Ief7851b022f10272a722fe7b7419e9e8b7df8e0b
Signed-off-by: Sunwook Bae <sunwook45.bae@samsung.com>
src/FCnt_DownloadManagerImpl.cpp

index 73dfb4f..9759a7a 100644 (file)
@@ -350,17 +350,22 @@ _DownloadManagerImpl::Start(const DownloadRequest& request, RequestId& reqId)
 
        //Set notification extra data
        std::unique_ptr<IMapEnumerator> pMapEnum(const_cast< IMap* >(request.GetNotificationExtraData())->GetMapEnumeratorN());
-        while (pMapEnum->MoveNext() == E_SUCCESS)
-        {
-                String* pMapKey = dynamic_cast<String*>(pMapEnum->GetKey());
-               unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pMapKey));
-                String* pMapValue = dynamic_cast<String*>(pMapEnum->GetValue());
-               const char* pValue = _StringConverter::CopyToCharArrayN(*pMapValue);
-
-               ret = download_add_notification_extra_param(download_id, pKey.get(), &pValue, 1);
-               delete[] pValue; 
-               SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
-        }
+
+       while (pMapEnum->MoveNext() == E_SUCCESS)
+       {
+               String* pMapKey = dynamic_cast<String*>(pMapEnum->GetKey());
+               String* pMapValue = dynamic_cast<String*>(pMapEnum->GetValue());
+
+               if (pMapKey && pMapValue)
+               {
+                       unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pMapKey));
+                       const char* pValue = _StringConverter::CopyToCharArrayN(*pMapValue);
+
+                       ret = download_add_notification_extra_param(download_id, pKey.get(), &pValue, 1);
+                       delete[] pValue;
+                       SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
+               }
+       }
 
        //Add http headers
        IMap* pRequestHeader = _DownloadRequestImpl::GetInstance(&request)->GetRequestHeader();