--- nvi-1.79.orig/ex/ex.c
+++ nvi-1.79/ex/ex.c
@@ -2307,7 +2307,7 @@
 	 * underlying file, that's the real problem.
 	 */
 	if (sp->ep == NULL) {
-		ex_emsg(sp, cp->name, EXM_NOFILEYET);
+ 		ex_emsg(sp, cp ? cp->name : NULL, EXM_NOFILEYET);
 		return;
 	}
 
