Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in PreferencesScreen #1006

Closed
crankycoder opened this issue Oct 15, 2014 · 2 comments
Closed

NPE in PreferencesScreen #1006

crankycoder opened this issue Oct 15, 2014 · 2 comments
Labels

Comments

@crankycoder
Copy link
Contributor

This is pretty odd, it looks like it's throwing a NPE when trying to grab a pointer to the application.

Crash:

org.mozilla.mozstumbler.client.subactivities.PreferencesScreen$4.onPreferenceClick(PreferencesScreen.java:99)

https://github.com/mozilla/MozStumbler/blob/v0.40.1.0/android/src/main/java/org/mozilla/mozstumbler/client/subactivities/PreferencesScreen.java#L99

java.lang.NullPointerException
at org.mozilla.mozstumbler.client.subactivities.PreferencesScreen$4.onPreferenceClick(PreferencesScreen.java:99)
at android.preference.Preference.performClick(Preference.java:941)
at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:202)
at android.widget.AdapterView.performItemClick(AdapterView.java:292)
at android.widget.AbsListView.performItemClick(AbsListView.java:1070)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:2527)
at android.widget.AbsListView$1.run(AbsListView.java:3188)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:110)
at dalvik.system.NativeStart.main(Native Method)
@crankycoder crankycoder added this to the 1.0 milestone Oct 15, 2014
@garvankeeley
Copy link
Contributor

Crazy, getApplication() should be non-null. There must be an application to create an activity.

I think the crash is here:
https://github.com/mozilla/MozStumbler/blob/v0.40.1.0/android/src/main/java/org/mozilla/mozstumbler/client/MainApp.java#L380

That the service is not yet created.

Also, there should be a null pointer check here:
https://github.com/mozilla/MozStumbler/blob/v0.40.1.0/android/src/main/java/org/mozilla/mozstumbler/client/MainApp.java#L382

Sloppy code on my part, oops.

@garvankeeley
Copy link
Contributor

pr #1007 fixes this, i hope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants