From 516f20856d63b137ea57e5ee3a0649294cd32adf Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 18 Jun 2021 13:40:33 +0200 Subject: [PATCH] adding a widget null check --- .../com/simplemobiletools/gallery/pro/extensions/Context.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index 021df6be3..9381115d6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -830,7 +830,8 @@ fun Context.deleteMediumWithPath(path: String) { } fun Context.updateWidgets() { - val widgetIDs = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(ComponentName(applicationContext, MyWidgetProvider::class.java)) ?: return + val widgetIDs = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(ComponentName(applicationContext, MyWidgetProvider::class.java)) + ?: return if (widgetIDs.isNotEmpty()) { Intent(applicationContext, MyWidgetProvider::class.java).apply { action = AppWidgetManager.ACTION_APPWIDGET_UPDATE