Add missing if
Merge pull request #576 from vishalsodani/master

Add missing if