This is a simplified fix compared to !288. @larssg does this address your concerns?
It's a little bit less clear than what you described because it relies on different behavior for FALSE and NULL but should be easier to review because it's a smaller change. I can modify it as you suggest though.