OpenLauncherTeam / openlauncher

Customizable and Open Source Launcher for Android
Apache License 2.0
1.41k stars 413 forks source link

Fix NullPointerException when restoring backup #558

Closed cmtjk closed 4 years ago

cmtjk commented 4 years ago

Non-breaking, but an improvement

There's a minor issue when restoring a backup, where Setup is not initialized for whatever reason. Instead of getting the AppSettings through the uninitialized Setup reference , we can access AppSettings directly. It's static anyway and never requires cumbersome initialization.

    java.lang.RuntimeException: Setup has not been initialised!
        at com.benny.openlauncher.manager.Setup.get(Setup.java:25)
        at com.benny.openlauncher.manager.Setup.appSettings(Setup.java:35)
        at com.benny.openlauncher.widget.ColorPreferenceCategory.onBindViewHolder(ColorPreferenceCategory.java:30)
        at android.support.v7.preference.PreferenceGroupAdapter.onBindViewHolder(PreferenceGroupAdapter.java:381)
        at android.support.v7.preference.PreferenceGroupAdapter.onBindViewHolder(PreferenceGroupAdapter.java:45)
        at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6781)
...

after restoring a backup and app is restarted