Guard against malformed paths.