Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

NullPointerException in ContentProviderStorage.java:104 #124

Open
BiglyBT opened this issue Dec 8, 2017 · 1 comment
Open

NullPointerException in ContentProviderStorage.java:104 #124

BiglyBT opened this issue Dec 8, 2017 · 1 comment

Comments

@BiglyBT
Copy link

BiglyBT commented Dec 8, 2017

tray Version

0.12.0

How have you setup tray

Initialized on a new thread invoked from Application.onCreate.
registerOnTrayPreferenceChangeListener called in a separate class with a OnTrayPreferenceChangeListener parameter of this (ie. it isn't null)

Device(s)

Motorola Moto G (5) Plus (potter_n)

Android Version (E.g. Marshmallow or better API 23)

Android 7.0

Stacktrace

Stacktrace
java.lang.NullPointerException: 
at net.grandcentrix.tray.provider.ContentProviderStorage$TrayContentObserver$1.run (ContentProviderStorage.java:104)
at android.os.Handler.handleCallback (Handler.java:751)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6123)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:757)

Description

I'm guessing my class that implements OnTrayPreferenceChangeListener is GC'd at one point. I see that the ContentProviderStorage uses a WeakHashMap, but does some other magic stuff (cloning, etc) which perhaps breaks the rule that they key will never be null. Or there's some other problem, I really don't know :O

I have only one registerOnTrayPreferenceChangeListener call, so I can guarantee I never try to call it with null (even if I did, the registerOnTrayPreferenceChangeListener code would catch the null listener)

@rzetzsche
Copy link

+1

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

No branches or pull requests

2 participants