diff --git a/app/src/main/java/com/github/libretube/dialogs/VideoOptionsDialog.kt b/app/src/main/java/com/github/libretube/dialogs/VideoOptionsDialog.kt index 9f007bd79..688e76a95 100644 --- a/app/src/main/java/com/github/libretube/dialogs/VideoOptionsDialog.kt +++ b/app/src/main/java/com/github/libretube/dialogs/VideoOptionsDialog.kt @@ -39,12 +39,16 @@ class VideoOptionsDialog( /** * Check whether the player is running by observing the notification */ - val notificationManager = - context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - notificationManager.activeNotifications.forEach { - if (it.id == PLAYER_NOTIFICATION_ID) { - optionsList += context?.getString(R.string.add_to_queue) + try { + val notificationManager = + context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + notificationManager.activeNotifications.forEach { + if (it.id == PLAYER_NOTIFICATION_ID) { + optionsList += context?.getString(R.string.add_to_queue) + } } + } catch (e: Exception) { + e.printStackTrace() } return MaterialAlertDialogBuilder(requireContext())