Fixed a crash when handling diagnostics without a valid file location, e.g. 'error reading <file>'.