https://kotlinlang.org logo
#rx
Title
# rx
m

Mohamed Ibrahim

11/07/2019, 8:32 AM
what will happen with this code, does it crash app or pass the exception down to
onError()
Copy code
val testNulls = Observable.create<String> {
        throw NullPointerException()//case 1
//        it.onNext(null!!) // case 2
        it.onNext("Ahmed")
    }
a

alexsullivan114

11/07/2019, 3:07 PM
Best way to find out is to test it, but I'd expect it to pass the initial NPE to the onError block
u

ursus

11/09/2019, 11:00 PM
I believe it will go to the uncaught handler
m

Mohamed Ibrahim

11/11/2019, 6:07 AM
well I did a test and throwing NLP in
create()
will just pass the exception to
onError()
but if you tried to pass Null as a value it will crash the stream
2 Views