NordicSemiconductor / Android-nRF-Mesh-Library

The Bluetooth Mesh Provisioner and Configurator library.
https://www.nordicsemi.com/
BSD 3-Clause "New" or "Revised" License
407 stars 177 forks source link

Crash after updating app from any version 2.4.4 and below to 3.0 and above #423

Closed BubblyNetDev closed 3 years ago

BubblyNetDev commented 3 years ago

Describe the bug Downloaded 2.4.4 and added a device, bound keys, and added subscriptions. Controlled device from 2.4.4 with no issues. Downloaded 3.1.5 and built app. Device TTL unknown and app crashes when trying to send messages.

To Reproduce Steps to reproduce the behavior:

  1. Build 2.4.4 and add a device, bind keys, and add subscriptions
  2. Update the app to version 3.0 or above
  3. Try to control device and app crashes

Logs / Screenshots

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: no.nordicsemi.android.nrfmeshprovisioner, PID: 9297
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
        at no.nordicsemi.android.mesh.transport.MeshTransport.createMeshMessage(MeshTransport.java:145)
        at no.nordicsemi.android.mesh.transport.ConfigMessageState.createAccessMessage(ConfigMessageState.java:69)
        at no.nordicsemi.android.mesh.transport.ConfigMessageState.<init>(ConfigMessageState.java:54)
        at no.nordicsemi.android.mesh.transport.BaseMeshMessageHandler.createConfigMeshMessage(BaseMeshMessageHandler.java:281)
        at no.nordicsemi.android.mesh.transport.BaseMeshMessageHandler.createMeshMessage(BaseMeshMessageHandler.java:247)
        at no.nordicsemi.android.mesh.MeshManagerApi.createMeshPdu(MeshManagerApi.java:891)
        at no.nordicsemi.android.nrfmesh.node.NodeConfigurationActivity.sendMessage(NodeConfigurationActivity.java:392)
        at no.nordicsemi.android.nrfmesh.node.NodeConfigurationActivity.onNodeReset(NodeConfigurationActivity.java:280)
        at no.nordicsemi.android.nrfmesh.node.dialog.DialogFragmentResetNode.lambda$onCreateDialog$0$DialogFragmentResetNode(DialogFragmentResetNode.java:60)
        at no.nordicsemi.android.nrfmesh.node.dialog.-$$Lambda$DialogFragmentResetNode$gCxhC2Iii6008Kq2hz97l_5HhbY.onClick(Unknown Source:2)
        at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
BubblyNetDev commented 3 years ago

I did notice that in multiple migrations of nodes the ttl field has been left out. I would assume this is intentional? When these are added into the migrations, the ttl is no longer unknown when updated and the app will not crash when sending a message.

roshanrajaratnam commented 3 years ago

Hi, yes there have been multiple migrations in between these versions, but should not crash the app when trying to control. I will have to debug this and see. I can't promise any dates as I have some other tasks in my plate.

BubblyNetDev commented 3 years ago

Okay, I added ttl to the migrations as a fix for now.

roshanrajaratnam commented 3 years ago

Sorry for the delay but is fixed, tested and working on dev now.