Regardless of the correctness of the code, if it's not obvious and you need to explain it, you probably should not write it (unless you have profile data that makes you do otherwise).
"Programs must be written for people to read, and only incidentally for machines to execute."
Therefore i would argue this is just as risky as the original solution, and that it's better to use the ternary operator