diff --git a/app/src/main/java/fr/free/nrw/commons/utils/DownloadUtils.kt b/app/src/main/java/fr/free/nrw/commons/utils/DownloadUtils.kt index 08c030e33..ced34f428 100644 --- a/app/src/main/java/fr/free/nrw/commons/utils/DownloadUtils.kt +++ b/app/src/main/java/fr/free/nrw/commons/utils/DownloadUtils.kt @@ -61,7 +61,10 @@ object DownloadUtils { req: DownloadManager.Request, ) { val systemService = - activity.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager - systemService?.enqueue(req) + activity.getSystemService(Context.DOWNLOAD_SERVICE) as? DownloadManager + if (systemService != null) { + systemService.enqueue(req) + } + else { Timber.e("DownloadManager service not available.") } } }