summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mg/buffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index ca1f30177f1..f5aba4c243d 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.102 2016/09/07 11:42:01 lum Exp $ */
+/* $OpenBSD: buffer.c,v 1.103 2017/03/13 20:32:58 florian Exp $ */
/* This file is in the public domain. */
@@ -89,6 +89,9 @@ usebuffer(int f, int n)
bufp = eread("Switch to buffer: (default %s) ", bufn, NBUFN,
EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname);
+ if (bufp == NULL)
+ return FALSE;
+
return (usebufname(bufp));
}