adding a widget null check

This commit is contained in:
tibbi 2021-06-18 13:40:33 +02:00
parent d56510874b
commit 516f20856d
1 changed files with 2 additions and 1 deletions

View File

@ -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