Avoid crashes in 'display_count_lines' when current buffer was killed
* src/xdisp.c (Fformat_mode_line): * src/fns.c (Fline_number_at_pos): Don't allow to count lines in a dead buffer. (Bug#65060)
This commit is contained in:
parent
47b4f4cf78
commit
8dbd5aa1ee
2 changed files with 5 additions and 0 deletions
|
@ -6123,6 +6123,9 @@ from the absolute start of the buffer, disregarding the narrowing. */)
|
||||||
{
|
{
|
||||||
ptrdiff_t pos_byte, start_byte = BEGV_BYTE;
|
ptrdiff_t pos_byte, start_byte = BEGV_BYTE;
|
||||||
|
|
||||||
|
if (!BUFFER_LIVE_P (current_buffer))
|
||||||
|
error ("Attempt to count lines in a dead buffer");
|
||||||
|
|
||||||
if (MARKERP (position))
|
if (MARKERP (position))
|
||||||
{
|
{
|
||||||
/* We don't trust the byte position if the marker's buffer is
|
/* We don't trust the byte position if the marker's buffer is
|
||||||
|
|
|
@ -27653,6 +27653,8 @@ are the selected window and the WINDOW's buffer). */)
|
||||||
if (NILP (buffer))
|
if (NILP (buffer))
|
||||||
buffer = w->contents;
|
buffer = w->contents;
|
||||||
CHECK_BUFFER (buffer);
|
CHECK_BUFFER (buffer);
|
||||||
|
if (!BUFFER_LIVE_P (XBUFFER (buffer)))
|
||||||
|
error ("Attempt to format a mode line for a dead buffer");
|
||||||
|
|
||||||
/* Make formatting the modeline a non-op when noninteractive, otherwise
|
/* Make formatting the modeline a non-op when noninteractive, otherwise
|
||||||
there will be problems later caused by a partially initialized frame. */
|
there will be problems later caused by a partially initialized frame. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue