Check that stat and lstat does not take an empty string as input.

Fixes #2211.
Add tests to check against stat of falsey values.