mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-21 07:18:05 -04:00
temporary workaround to NPE crash on first install
The solution is really to get rid of the Fragment and do everything in the Activity, especially since this nullguard will probably leave things in a not good state. But that's better than a crash, I think. W java.lang.NullPointerException W at org.fdroid.fdroid.views.fragments.AvailableAppsFragment$CategoryObserver.onChange(AvailableAppsFragment.java:88) W at org.fdroid.fdroid.views.fragments.AvailableAppsFragment$CategoryObserver.onChange(AvailableAppsFragment.java:103) W at android.database.ContentObserver.dispatchChange(ContentObserver.java:163) W at android.database.ContentObserver$Transport.onChange(ContentObserver.java:195) W at android.database.IContentObserver$Stub.onTransact(IContentObserver.java:60) W at android.os.Binder.execTransact(Binder.java:404) W at dalvik.system.NativeStart.run(Native Method)
This commit is contained in:
@@ -84,7 +84,11 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
// Wanted to just do this update here, but android tells
|
||||
// me that "Only the original thread that created a view
|
||||
// hierarchy can touch its views."
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
final Activity activity = getActivity();
|
||||
// this nullguard is temporary, this Fragment really needs to merged into the Activity
|
||||
if (activity == null)
|
||||
return;
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (adapter == null) {
|
||||
|
||||
Reference in New Issue
Block a user