Fixed bad comparison logic introduced in d97bf2e9c8971764690caaf81a0914bc368d6b02.

Refs #21765.

Thanks to kezabelle for the quick report and to onjin
for providing the patch.