Combine 'if' statements into one condition

#4351