NullPointerException on Android whenever Backendless servers are down

Hi!

We have for the latest downtimes of Backendless servers seen weird crashes in our Android applications.These stop once the server is back up but whenever Backendless servers are down we see spikes in crash reports. Example:

java.lang.NullPointerException: 
  at com.indevlabs.shlive.LivePage$fetchGames$1.handleResponse (LivePage.kt:109)
  at com.backendless.async.message.AsyncMessage$ResponseHandler.handle (AsyncMessage.java:64)
  at com.backendless.async.message.AsyncMessage.handleCallback (AsyncMessage.java:41)
  at com.backendless.core.AndroidCarrier$1.handleMessage (AndroidCarrier.java:37)
  at android.os.Handler.dispatchMessage (Handler.java:103)
  at android.os.Looper.loop (Looper.java:213)
  at android.app.ActivityThread.main (ActivityThread.java:8178)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:513)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1101)

We’ve checked our line 109 and it looks like this:
Backendless.Persistence.of(Games::class.java).find(queryBuilder, object : AsyncCallback<List<Games>> {

And the content after it is the following:

       override fun handleResponse(foundGames: List<Games>) {
            handleGames(foundGames)

            if (refresh_live != null) {
                refresh_live.isRefreshing = false
            }
        }

        override fun handleFault(fault: BackendlessFault) {
            println(fault)
        }
    })

We can’t understand why we get a NullPointerException when the servers are down in this code… Shouldn’t a downtime throw the handleFault callback? (We are using the SDK 6.2.1)

I tried to gather some more information during the most recent 502 error with the servers (around 10-15 minutes ago). The error message is the same as in my first message, however I could see that the description of the error was something along the lines of “parameter specified as non-null is null”. Do we receive a call to handleResponse() with a null value when something happens unexpectedly in the Backendless SDK?

Best Regards,
Tobias

Thanks for you investigation.
Now it’s our turn to see what’s going on there.
What language do you use – Java/Kotlin ?
p.s.
Inner ticket [BKNDLSS-24499]

Hi!

We are using kotlin for our application!