diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt index d637565..4b23264 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt @@ -55,8 +55,12 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment binding.widgetsList.scrollToPosition(0) setupViews() - val appWidgets = (binding.widgetsList.adapter as WidgetsAdapter).widgetListItems - setupAdapter(appWidgets) + val appWidgets = (binding.widgetsList.adapter as? WidgetsAdapter)?.widgetListItems + if (appWidgets != null) { + setupAdapter(appWidgets) + } else { + getAppWidgets() + } } override fun onInterceptTouchEvent(event: MotionEvent?): Boolean {