fix options dialog crash

This commit is contained in:
Bnyro 2022-08-19 15:15:27 +02:00
parent b259bfb8b0
commit 7fea27b299

View File

@ -39,12 +39,16 @@ class VideoOptionsDialog(
/** /**
* Check whether the player is running by observing the notification * Check whether the player is running by observing the notification
*/ */
val notificationManager = try {
context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val notificationManager =
notificationManager.activeNotifications.forEach { context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
if (it.id == PLAYER_NOTIFICATION_ID) { notificationManager.activeNotifications.forEach {
optionsList += context?.getString(R.string.add_to_queue) if (it.id == PLAYER_NOTIFICATION_ID) {
optionsList += context?.getString(R.string.add_to_queue)
}
} }
} catch (e: Exception) {
e.printStackTrace()
} }
return MaterialAlertDialogBuilder(requireContext()) return MaterialAlertDialogBuilder(requireContext())