Fix segfault on NULL file