Getting null error after explicit null check... how?

I've got a very short function, here:


As you can very clearly see, it's checking data != null && data.size() > 0

Yet I'm getting this error in my logs:

That function for sure exists on the parent:
and it's doing a ?. anyway.

So data cannot be null at line 2708... this.device is never null by nature, and I've added an explicit check for null on this.device just for giggles and it had no affect.:

And you can clearly see that the logWarn that logs the Map data is also very much not null, yet it still spits out an error:

I've also tried changing the parent function to accept anything and just return:

No affect on this null error.

Where the HECK is this null error coming from?

More info:

Adding this helper method:

and using it:

moves the null error up to line 1193:

It's as if this device doesn't know what its parent app is anymore.

should be != not

It is, VS Code + Fira Code font just renders it that way.

Here's the code copy-pasted into a code block:

void isFavoritePlaying(Map eventData) {
  if(eventData != null && eventData.size() > 0 && getParentApp() != null && getThisDevice() != null) {
    getParentApp()?.isFavoritePlaying(getThisDevice(), eventData)

It's the 'ligatures' setting here:

Which renders other things differently too, like this: image

It's all purely visual, the actual characters in the code are the same, that's >= in the actual code text, it just displays as image

But even if it were what you're suggesting, that doesn't affect the fact that this code is returning null:

And when I look at the device itself in HE, it no longer lists a parent app. The only way these devices are created is via the parent app:

So I have no idea how the parent app could be removed without removing the child devices, but that seems to have been what happened, since the parent app is indeed gone, leaving a bunch of orphaned child devices behind.

So it seems that the parent app got uninstalled without removing the child devices, which should never happen.

This is my uninstalled():

which calls:

Not to mention that HE itself usually enforces the removal of child devices when the parent app is removed:

So anyway... there's a bug somewhere in HE code that allowed the parent to get uninstalled/removed without calling uninstalled() and/or doing whatever happens behind the scenes when that "Confirmation" popup is clicked on "Yes".

May depend on whether the child device is created (added) with isComponent true or false.

Nope, that just affects whether or not you can delete the device 'out from under' the parent app.

I'm not setting it, so it defaults to false.

The above "This will remove 7 child devices..." confirmation is with isComponent = false. It doesn't matter if the children are a component or not, if you delete the parent it's supposed to take the children with it.

Not to mention my "uninstalled()" on the parent app very explicitly calls deleteChildDevice() on all of the children.

I'll have to dig through some of my old code, as there was some condition I needed to explicitly code the device removal for.