Closed Massedil closed 6 years ago
Was the back end being started or stopped at the time this exception occurred? The code specifically checks for null values before entering that area, however one of the null checks is not within the synchronized block. So maybe the value changed after the check but before use. . .
I was using a GPS app (OSMAnd) since some minutes. And I don't have launched UnifiedNlp app.
Not sure if this fix will correct this, but it can't hurt.
I have a similar issue:
03-03 08:20:28.635 E/AndroidRuntime(18427): java.lang.NullPointerException: Attempt to invoke virtual method 'org.fitchfamily.android.dejavu.RfEmitter org.fitchfamily.android.dejavu.Database.getEmitter(org.fitchfamily.android.dejavu.RfIdentification)' on a null object reference
03-03 08:20:28.635 E/AndroidRuntime(18427): at org.fitchfamily.android.dejavu.Cache.get(Cache.java:106)
03-03 08:20:28.635 E/AndroidRuntime(18427): at org.fitchfamily.android.dejavu.BackendService.backgroundProcessing(BackendService.java:707)
03-03 08:20:28.635 E/AndroidRuntime(18427): at org.fitchfamily.android.dejavu.BackendService.access$300(BackendService.java:71)
03-03 08:20:28.635 E/AndroidRuntime(18427): at org.fitchfamily.android.dejavu.BackendService$4.run(BackendService.java:668)
03-03 08:20:28.635 E/AndroidRuntime(18427): at java.lang.Thread.run(Thread.java:764)
This log is a bit old but the crash was still occurring recently in the same conditions: just after leaving an PokémonGO. I cannot reproduce it anymore for now because of SafetyNet failing with μG currently, but will try once that last thing is fixed.
@ArchangeGabriel What version of DejaVu are you using? I was pretty sure this particular null pointer error was fixed in the most recent version.
I cannot tell for sure which version that was at that point. Will get a logcat of a recent crash when I get the opportunity.
@n76: I'm not sure but isn't the db == null
check needed ony inside rslt == null
?
Yes and no. The cache should represent what is in the database, so if we don't have a database we should have nothing in the cache. But technically, you are correct: At that point in the code we really only need to test for db == null
if rslt == null
. But since we shouldn't be executing the workingset.put()
with the RF emitter data unless we have the database opened we should have nothing in the cache always be getting rslt == null
if db == null
The interesting part of this is the crash is reported as occurring just after leaving an app that used location services. And the only time we might have a timing error that has us trying to access the cache before the database has been opened is when we are just starting. So why is UnifiedNlp or microG core restarting the backend at that time?
Could you create a debug version that log every start/close/restart action of the backend?
02-25 02:25:35.118 E/AndroidRuntime(9342): FATAL EXCEPTION: Thread-133 02-25 02:25:35.118 E/AndroidRuntime(9342): Process: org.fitchfamily.android.dejavu, PID: 9342 02-25 02:25:35.118 E/AndroidRuntime(9342): java.lang.NullPointerException: Attempt to invoke virtual method 'org.fitchfamily.android.dejavu.RfEmitter org.fitchfamily.android.dejavu.Database.getEmitter(org.fitchfamily.android.dejavu.RfIdentification)' on a null object reference 02-25 02:25:35.118 E/AndroidRuntime(9342): at org.fitchfamily.android.dejavu.Cache.get(Cache.java:106) 02-25 02:25:35.118 E/AndroidRuntime(9342): at org.fitchfamily.android.dejavu.BackendService.getRfLocations(BackendService.java:759) 02-25 02:25:35.118 E/AndroidRuntime(9342): at org.fitchfamily.android.dejavu.BackendService.endOfPeriodProcessing(BackendService.java:912) 02-25 02:25:35.118 E/AndroidRuntime(9342): at org.fitchfamily.android.dejavu.BackendService.backgroundProcessing(BackendService.java:727) 02-25 02:25:35.118 E/AndroidRuntime(9342): at org.fitchfamily.android.dejavu.BackendService.access$300(BackendService.java:71) 02-25 02:25:35.118 E/AndroidRuntime(9342): at org.fitchfamily.android.dejavu.BackendService$4.run(BackendService.java:668) 02-25 02:25:35.118 E/AndroidRuntime(9342): at java.lang.Thread.run(Thread.java:761)