diff --git a/src/nano.c b/src/nano.c
index e8febbb892071ae38a54b5222ef154da8e394101..c2e36587524652c99ecf79b03090579aa0c8b6a0 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1626,7 +1626,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
 #endif
 				iso_me_harder_funcmap(s->scfunc);
 #ifdef ENABLE_COLOR
-				if (!f->viewok && openfile->syntax != NULL
+				if (f && !f->viewok && openfile->syntax != NULL
 					&& openfile->syntax->nmultis > 0) {
 				    reset_multis(openfile->current, FALSE);
 				}
diff --git a/src/prompt.c b/src/prompt.c
index 9377ec673e3771af42dcbc7e098e24f5bed6c1a1..38e893097f94e20a2074a3f18b4d4e69ca64fac3 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -229,7 +229,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
 		f = sctofunc((sc *) s);
 		if (s->scfunc != 0 &&  s->execute == TRUE) {
 			*ran_func = TRUE;
-		    if (!ISSET(VIEW_MODE) || f->viewok)
+		    if (f && (!ISSET(VIEW_MODE) || (f->viewok)))
 		        iso_me_harder_funcmap(f->scfunc);
 		}
 		*finished = TRUE;