changeset 78428:65b1a3eb58c4

(redisplay_window): When restoring original buffer position, make sure it is still valid.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 06 Aug 2007 17:23:03 +0000
parents fcb3df3845ab
children a3a4480349cb
files src/xdisp.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Mon Aug 06 17:22:44 2007 +0000
+++ b/src/xdisp.c	Mon Aug 06 17:23:03 2007 +0000
@@ -13520,7 +13520,10 @@
   /* Restore current_buffer and value of point in it.  */
   TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint));
   set_buffer_internal_1 (old);
-  TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint));
+  /* Avoid an abort in TEMP_SET_PT_BOTH if the buffer has become
+     shorter.  This can be caused by log truncation in *Messages*. */
+  if (CHARPOS (lpoint) <= ZV)
+    TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint));
 
   unbind_to (count, Qnil);
 }