* 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)
{
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))
{
/* We don't trust the byte position if the marker's buffer is
if (NILP (buffer))
buffer = w->contents;
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
there will be problems later caused by a partially initialized frame. */