try to mitigate #172

This commit is contained in:
Josia Pietsch 2025-05-17 11:42:21 +02:00
parent 5f847a8d40
commit 31a9049861
Signed by: jrpie
GPG key ID: E70B571D66986A2D
3 changed files with 18 additions and 3 deletions

View file

@ -122,7 +122,12 @@ class HomeActivity : UIObject, Activity() {
}
override fun onPause() {
(application as Application).appWidgetHost.stopListening()
try {
(application as Application).appWidgetHost.stopListening()
} catch (e: Exception) {
// Throws a NullPointerException on Android 12 an earlier, see #172
e.printStackTrace()
}
super.onPause()
}

View file

@ -62,7 +62,12 @@ class WidgetPanelActivity : Activity(), UIObject {
}
override fun onPause() {
(application as Application).appWidgetHost.stopListening()
try {
(application as Application).appWidgetHost.stopListening()
} catch (e: Exception) {
// Throws a NullPointerException on Android 12 an earlier, see #172
e.printStackTrace()
}
super.onPause()
}

View file

@ -93,7 +93,12 @@ class ManageWidgetsActivity : UIObject, Activity() {
}
override fun onPause() {
(application as Application).appWidgetHost.stopListening()
try {
(application as Application).appWidgetHost.stopListening()
} catch (e: Exception) {
// Throws a NullPointerException on Android 12 an earlier, see #172
e.printStackTrace()
}
super.onPause()
}