Removing unnecessary if check for error

Removing unnecessary if check for error as per code review comment.