(Fchar_before): Do range check before decrement.
authorRichard M. Stallman <rms@gnu.org>
Mon, 18 Aug 1997 18:56:07 +0000 (18:56 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 18 Aug 1997 18:56:07 +0000 (18:56 +0000)
src/editfns.c

index c8a6506..c12ea5a 100644 (file)
@@ -610,18 +610,17 @@ is returned as a character.")
       n = XINT (pos);
     }
 
+  if (n <= BEGV || n > ZV)
+    return Qnil;
+
   if (!NILP (current_buffer->enable_multibyte_characters))
     {
       DEC_POS (n);
-      if (n < BEGV || n >= ZV)
-       return Qnil;
       XSETFASTINT (val, FETCH_CHAR (n));
     }
   else
     {
       n--;
-      if (n < BEGV || n >= ZV)
-       return Qnil;
       XSETFASTINT (val, FETCH_BYTE (n));
     }
    return val;