Crash due to LocationServicesOkObservableApi23 somewhere has null
See original GitHub issueHi guys! Thank you for that awesome lib you’ve created! I was migrating from com.polidea.rxandroidble:rxandroidble:1.4.3 to com.polidea.rxandroidble2:rxandroidble:1.5.0 recently and faced troubles on APIs > 22. Seems that inside a library there is some nulls passed to observables, but RxJava2 does not allow this. So I can’t use it any more. That seems to be a thing with location permissions, but actually runtime ACCESS_COARSE_LOCATION was granted. Ccrash sometimes happens when I simply try to obtain RxBleClient instance. I would really appreciate your help. Thanks in advance!
Summary
Library version
1.5.0
Logs from the application (crash report)
03-21 19:53:04.561 29366-29533/com.vue E/AndroidRuntime: FATAL EXCEPTION: RxComputationThreadPool-1
Process: com.vue, PID: 29366
java.lang.NullPointerException: Attempt to invoke interface method 'boolean io.reactivex.internal.fuseable.SimpleQueue.offer(java.lang.Object)' on a null object reference
at io.reactivex.internal.operators.observable.ObservableSwitchMap$SwitchMapInnerObserver.onNext(ObservableSwitchMap.java:372)
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:64)
at com.polidea.rxandroidble2.internal.util.LocationServicesOkObservableApi23.subscribeActual(LocationServicesOkObservableApi23.java:35)
at io.reactivex.Observable.subscribe(Observable.java:12005)
at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
at io.reactivex.Observable.subscribe(Observable.java:12005)
at io.reactivex.internal.operators.observable.ObservableSwitchMap$SwitchMapObserver.onNext(ObservableSwitchMap.java:127)
at io.reactivex.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver.drain(ObservableConcatMap.java:464)
at io.reactivex.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver.onSubscribe(ObservableConcatMap.java:324)
at io.reactivex.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:30)
at io.reactivex.Observable.subscribe(Observable.java:12005)
at io.reactivex.internal.operators.observable.ObservableConcatMap.subscribeActual(ObservableConcatMap.java:54)
at io.reactivex.Observable.subscribe(Observable.java:12005)
at io.reactivex.internal.operators.observable.ObservableSwitchMap.subscribeActual(ObservableSwitchMap.java:51)
at io.reactivex.Observable.subscribe(Observable.java:12005)
at io.reactivex.internal.operators.observable.ObservableSkip.subscribeActual(ObservableSkip.java:29)
at io.reactivex.Observable.subscribe(Observable.java:12005)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:165)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
at io.reactivex.internal.observers.DeferredScalarDisposable.complete(DeferredScalarDisposable.java:82)
at io.reactivex.internal.operators.single.SingleToObservable$SingleToObservableObserver.onSuccess(SingleToObservable.java:73)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
at io.reactivex.internal.operators.observable.ObservableCountSingle$CountObserver.onComplete(ObservableCountSingle.java:83)
at io.reactivex.internal.operators.observable.ObservableTakeWhile$TakeWhileObserver.onNext(ObservableTakeWhile.java:86)
at io.reactivex.internal.operators.observable.ObservableInterval$IntervalObserver.run(ObservableInterval.java:83)
at io.reactivex.internal.schedulers.ScheduledDirectPeriodicTask.run(ScheduledDirectPeriodicTask.java:38)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:278)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:154)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:270)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Actual result
App crashes on start
Expected result
App does not crash on start
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:25 (10 by maintainers)
Top Results From Across the Web
Crash due to LocationServicesOkObservableApi23 ... - GitHub
Crash due to LocationServicesOkObservableApi23 somewhere has null #404 ... Seems that inside a library there is some nulls passed to ...
Read more >LO67238: LS2J CRASH WHEN NULL RETURNED BY JAVA ...
returnNullForStringArray () calling this Java method public String[] ... Crash from this test case has been reproduced on Domino 7.0.3FP1 and Domino 8.5.3....
Read more >Activity Intent sometimes has null extra - Stack Overflow
I'm seeing a problem where an Activity crashes grabbing an Intent extra due to it being null despite not being able to identify...
Read more >Null safety - Kotlin
An uninitialized this available in a constructor is passed and used somewhere (a "leaking this "). A superclass constructor calls an open member ......
Read more >Exploitable or Not Exploitable? Using REVEN to Examine a ...
In this post, we'll show how to decide if a vulnerability is ... It looks like a NULL-pointer dereference since it's crashing due...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Calling onSubscribe is mandatory in RxJava 2.x. Also the preferred way of creating bridges to no-rx sources is Observable.create() which has safeguards guarding against this type of mistakes.
I’m seeing this issue with RxJava 2.1.11 (https://github.com/ReactiveX/RxJava/commit/8a6bf14fc9a61f7c1c0016ca217be02ca86211d2) this commit changed how the queue is initialized. For now, I suggest staying with RxJava 2.1.10. I’ll try to find out why it happens and submit an issue to RxJava repo.