DaveGut / Test-Code

Test Code
38 stars 18 forks source link

Error upon loading app #10

Closed masterfud closed 4 years ago

masterfud commented 4 years ago

Hi I had added the Application code.
Then I added a device driver code I thought was the plug but wasn't.
When I went to add the 2 devices the App found, they didn't get added to the Devices list. I didn't know what was going on until I checked the logs and it said that the plug switch driver wasn't found. I installed the correct driver and one device was added immediately without further intervention. Upon trying to access the App again to get it to register the 2nd device, it errored with the following in the log. java.lang.NullPointerException: Cannot get property 'value' on null object on line 225 (mainPage) I tried restarting the hub but got the same error.
I'm not a Java dev but I was poking around the code and I noticed that upon init if selectedAddDevices was defined? (don't know enough Java) it would call addDevices. I assume that one of the devices in that list? was null somehow so I cp'd the app?.removeSetting("selectedAddDevices") code I found down in addDevices into initialize instead of the call to addDevices. That got the init to work properly and after searching again it found the 1 remaining device which I was able to add. Not sure if anyone else has managed to screw it up in this manner. Also not sure if you prefer this vs the hubitat forum.

Thanks for all your work.

DaveGut commented 4 years ago

Good idea to move segment; however, I will put in both places (to clear out data in the state when it is irrelevant).