FB AudienceNetwork - NullPointerException crash

Recently I’ve been seeing the following crash from the FBAN plugin:

java.lang.NullPointerException Java Stack Trace: plugin.fbAudienceNetwork.LuaLoader.isSDKInitialized(LuaLoader.java:379) plugin.fbAudienceNetwork.LuaLoader.access$2200(LuaLoader.java:55) plugin.fbAudienceNetwork.LuaLoader$load.invoke(LuaLoader.java:864) com.naef.jnlua.LuaState.lua\_pcall(Native Method) com.naef.jnlua.LuaState.call(Unknown Source) com.ansca.corona.CoronaLua.dispatchEvent(CoronaLua.java:138) network.NetworkRequest$LuaCallback$1.executeUsing(NetworkRequest.java:610) com.ansca.corona.CoronaRuntimeTaskDispatcher$TaskEvent.Send(CoronaRuntimeTaskDispatcher.java:170) com.ansca.corona.events.EventManager.sendEvents(EventManager.java:91) com.ansca.corona.Controller.updateRuntimeState(Controller.java:308) com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:421) com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1623) com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378)

The trigger for the crash is a call to load():

fbAudienceNetwork.load("interstitial", placementName)

This is called only if the plugin was initialized and an event with the phase “init” has been received. 

Any idea why this is happening?

I’ll have a look and report back on this thread.

@Stanga

I can’t replicate the issue.

Is this something you see in the Google Play Console reports, or in a local app during testing?

We log all the crashes the app detect to a remote server, so this crash happened to some of our users.

It doesn’t reproduce a lot, but still happens every now and then. 

I checked and it happened to users with the following devices:

ASUS_T00J - Android 4.4.2

HUAWEI Y625-U51 - Android 4.4.2

So maybe the problem is in the Android version 4.4.2?

The closest device I have is a Galaxy S3 with Android 4.4.4 (where it doesn’t happen).

After looking at the code the only time this can happen is if the user somehow manages to exit the app just before the load() is called. I’ll tighten up the code to avoid this issue. 

It makes sense that this is some strange edge case. 

Thanks :slight_smile:

@stanga

This edge-case should be fixed now, and it’s live.

I’ll have a look and report back on this thread.

@Stanga

I can’t replicate the issue.

Is this something you see in the Google Play Console reports, or in a local app during testing?

We log all the crashes the app detect to a remote server, so this crash happened to some of our users.

It doesn’t reproduce a lot, but still happens every now and then. 

I checked and it happened to users with the following devices:

ASUS_T00J - Android 4.4.2

HUAWEI Y625-U51 - Android 4.4.2

So maybe the problem is in the Android version 4.4.2?

The closest device I have is a Galaxy S3 with Android 4.4.4 (where it doesn’t happen).

After looking at the code the only time this can happen is if the user somehow manages to exit the app just before the load() is called. I’ll tighten up the code to avoid this issue. 

It makes sense that this is some strange edge case. 

Thanks :slight_smile:

@stanga

This edge-case should be fixed now, and it’s live.