Change-Id: I9f73bf0e873923dc729e8d3a7665b8e1d7ffd419
Signed-off-by: Sunwook Bae <sunwook45.bae@samsung.com>
_DownloadManagerImpl* pDMImpl = (_DownloadManagerImpl*)data;
_DownloadManagerImpl* pDMImpl = (_DownloadManagerImpl*)data;
- if (!data || !pDMImpl->__pEvent)
- _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
- pEventArg->__id = reqId;
- pEventArg->__state = STATE_PAUSED;
+ if (pDMImpl->__pEvent)
+ {
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = STATE_PAUSED;
- pDMImpl->__pEvent->Fire(*pEventArg);
+ pDMImpl->__pEvent->Fire(*pEventArg);
+ }
break;
}
case SLP_STATE_COMPLETED:
{
break;
}
case SLP_STATE_COMPLETED:
{
- _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
- pEventArg->__id = reqId;
- pEventArg->__state = STATE_COMPLETED;
+ if (pDMImpl->__pEvent)
+ {
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = STATE_COMPLETED;
- char* path = null;
- download_get_downloaded_file_path(download_id, &path);
- pEventArg->__path = path;
+ char* path = null;
+ download_get_downloaded_file_path(download_id, &path);
+ pEventArg->__path = path;
- pDMImpl->__pEvent->Fire(*pEventArg);
+ pDMImpl->__pEvent->Fire(*pEventArg);
+ }
// Remove the resource from url_download
pDMImpl->DestroyResources(reqId);
// Remove the resource from url_download
pDMImpl->DestroyResources(reqId);
- _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
- pEventArg->__id = reqId;
- pEventArg->__state = STATE_FAILED;
+ if (pDMImpl->__pEvent)
+ {
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = STATE_FAILED;
- download_error_e error;
- download_get_error(download_id, &error);
- pEventArg->__result = pDMImpl->ConvertToResult(error);
+ download_error_e error;
+ download_get_error(download_id, &error);
+ pEventArg->__result = pDMImpl->ConvertToResult(error);
- int http_status = 0;
- download_get_http_status(download_id, &http_status);
- pEventArg->__errorCode = Integer::ToString(http_status);
+ int http_status = 0;
+ download_get_http_status(download_id, &http_status);
+ pEventArg->__errorCode = Integer::ToString(http_status);
- pDMImpl->__pEvent->Fire(*pEventArg);
+ pDMImpl->__pEvent->Fire(*pEventArg);
+ }
// Comment out due to resume the failed request
//pDMImpl->DestroyResources(reqId);
// Comment out due to resume the failed request
//pDMImpl->DestroyResources(reqId);
case SLP_STATE_CANCELLED:
{
case SLP_STATE_CANCELLED:
{
- _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
- pEventArg->__id = reqId;
- pEventArg->__state = STATE_CANCELLED;
+ if (pDMImpl->__pEvent)
+ {
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = STATE_CANCELLED;
- pDMImpl->__pEvent->Fire(*pEventArg);
+ pDMImpl->__pEvent->Fire(*pEventArg);
+ }
// Remove the resource from url_download
pDMImpl->DestroyResources(reqId);
// Remove the resource from url_download
pDMImpl->DestroyResources(reqId);