Check "sha" is not empty as well as checking for null

In my working copy the "sha" var was empty, not null and was throwing an exception.