Skip to content

Commit

Permalink
Fixed a couple of crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
acristescu committed Jun 7, 2024
1 parent d5c7c7c commit e383046
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,11 @@ private class PopupLayout(
params.x = popupPosition.x
params.y = popupPosition.y

windowManager.updateViewLayout(this, params)
try {
windowManager.updateViewLayout(this, params)
} catch (_: Exception) {
// Ignore the exception if the view is not attached to the window.
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ class MainActivity : AppCompatActivity(), MainContract.View {
NotificationChannelGroup("blitz", "Blitz"),
)
.map { it.id }
.map(notificationManager::deleteNotificationChannelGroup)
.map {
try {
notificationManager.deleteNotificationChannelGroup(it)
} catch (_: Exception) {
// a bug in Oreo where deleting a non-existant notification channel group throws an NPE
}
}

notificationManager.createNotificationChannelGroup(
NotificationChannelGroup("your_turn", "Your Turn")
Expand Down

0 comments on commit e383046

Please sign in to comment.