//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();