changeset 11503:9d8bb1074fd8

(Fexpand_abbrev): Add some error checking.
author Karl Heuer <kwzh@gnu.org>
date Thu, 20 Apr 1995 21:15:39 +0000
parents 7ecd4aa33faa
children ae5b033ad31f
files src/abbrev.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/abbrev.c	Thu Apr 20 18:37:39 1995 +0000
+++ b/src/abbrev.c	Thu Apr 20 21:15:39 1995 +0000
@@ -229,7 +229,9 @@
      expansion".  */
   value = (MODIFF != oldmodiff ? Qt : Qnil);
 
-  if (XBUFFER (Vabbrev_start_location_buffer) != current_buffer)
+  wordstart = 0;
+  if (!(BUFFERP (Vabbrev_start_location_buffer) &&
+	XBUFFER (Vabbrev_start_location_buffer) == current_buffer))
     Vabbrev_start_location = Qnil;
   if (!NILP (Vabbrev_start_location))
     {
@@ -237,10 +239,12 @@
       CHECK_NUMBER_COERCE_MARKER (tem, 0);
       wordstart = XINT (tem);
       Vabbrev_start_location = Qnil;
-      if (FETCH_CHAR (wordstart) == '-')
+      if (wordstart < BEGV || wordstart > ZV)
+	wordstart = 0;
+      if (wordstart && wordstart != ZV && FETCH_CHAR (wordstart) == '-')
 	del_range (wordstart, wordstart + 1);
     }
-  else
+  if (!wordstart)
     wordstart = scan_words (point, -1);
 
   if (!wordstart)