Added a condition and tested successfully

Added a condition and tested successfully