A reference to a button does not just nullify itself. There’s something going on we don’t know about. Do you, perhaps, remove that button? Also, there’s no need for additional boolean in this case - you can right click a ref var and convert it into the Validated variant.
edit:
The above makes no sense, for example - you create a widget but do not do anything with it. So now you could end up in a situation where you have 2 inventories (one orphaned). Admittedly this one will be Garbage Collected soon. It does not do anything.
It’s impossible to follow the logic without seeing the whole thing.