Prevent a NPE if path doesn't have a parent directory