summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-05 19:36:38 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-05 19:36:38 +0100
commit00806bceb6dc9c8dcd308e5f7e50f720f7dc71b0 (patch)
treebf1d99fc4d9567c97dc56b4e6d0edffd74981b7e /src/buffer.c
parentb885b435d126d34475714e39ec1125bd4e1c77c6 (diff)
patch 8.2.1959: crash when terminal buffer name is made emptyv8.2.1959
Problem: Crash when terminal buffer name is made empty. (Dhiraj Mishra) Solution: Fall back to "[No Name]". (closes #7262)
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index c804348e19..a4c6a00b53 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5648,11 +5648,22 @@ buf_spname(buf_T *buf)
}
if (buf->b_fname == NULL)
- return (char_u *)_("[No Name]");
+ return buf_get_fname(buf);
return NULL;
}
/*
+ * Get "buf->b_fname", use "[No Name]" if it is NULL.
+ */
+ char_u *
+buf_get_fname(buf_T *buf)
+{
+ if (buf->b_fname == NULL)
+ return (char_u *)_("[No Name]");
+ return buf->b_fname;
+}
+
+/*
* Set 'buflisted' for curbuf to "on" and trigger autocommands if it changed.
*/
void