NullPointerException using ButtonController (2.2.4.158)

Hi!

So if I want to edit an action of the buttons on one of my button controllers (app), I get a NPE in the logs and I cannot modify the actions at all.

I am not allowed insert links or even insert images here, so I guess I will copy paste:

Unexpected Error
An unexpected error has occurred trying to load the app. Check Logs for more information.
Error: Cannot invoke method tokenize() on null object

[app:94] 2021-01-13 15:23:45.107 [error/installedapp/configure/94)java.lang.NullPointerException: Cannot invoke method tokenize() on null object on line 561 (selectActions)

Funny enough this seems unique for this particular app controller, I can see and edit actions of another button controller if I try to.

So I think MAYBE I can delete this one and re-create it. But I would prefer not to, I am worried I will just get this issue again so want to make you aware.

I am on version 2.2.4.158, and I also only have 1 user app; Package Manger, but have nothing else installer except a customer driver for xiaomi sensors.

Thanks!

There's no way to know or find out exactly what messed up this instance. You do need to remove and recreate it.

...but it does seem to happen a lot. I’ve been down this road a number of times...

If you haven't yet, try the community app Advanced Button Controller. It looks nice, and is very easy to use.

Alright thanks! -- I was hoping one could just wrap that whole area with a try/catch and hope to see the problem :stuck_out_tongue:

Thanks Andy, that means I should hope this is the last time. I might try some other app then!

Thanks neonturbo! I will def check this ABC app out! :slight_smile:

Well, maybe, but that won't do you any good. It turns out this particular problem would not be revealed by a try-catch. I know exactly what causes the error, but the underlying failure is not visible, nor catchable. Something corrupts a data structure. From what I can tell, most likely this stems from something like hitting back in the browser while creating a rule, leaving behind a partial data structure. There is no obvious way to correct that.

Interesting, thanks for getting back to me bravenel!
I may have indeed sometimes by mistake clicked back or swiped back while creating some of the controllers. I just checked and worryingly many of my controllers cause one of these exceptions. Including some that I am sure I have edited after first creation. So to me that seems that these data structures may become broken also after first creation.
I guess I have to recreate all of these, I will try to keep an eye open for mistakes I make while creating them!

List item