[1.5.x] Added missing parentheses in if clause

Backport of 1f8e7bb07 from master.