changeset 2779:857bb0f59668

* intervals.c (set_point): Check for point out of bounds before checking for an empty interval tree.
author Jim Blandy <jimb@redhat.com>
date Fri, 14 May 1993 14:40:56 +0000
parents 071fa2f469d7
children cfe7659bbc05
files src/intervals.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/intervals.c	Fri May 14 14:39:15 1993 +0000
+++ b/src/intervals.c	Fri May 14 14:40:56 1993 +0000
@@ -1254,16 +1254,18 @@
   if (position == buffer->text.pt)
     return;
 
+  /* Check this now, before checking if the buffer has any intervals.
+     That way, we can catch conditions which break this sanity check
+     whether or not there are intervals in the buffer.  */
+  if (position > BUF_Z (buffer) || position < BUF_BEG (buffer))
+    abort ();
+
   if (NULL_INTERVAL_P (buffer->intervals))
     {
       buffer->text.pt = position;
       return;
     }
 
-  /* Perhaps we should just change `position' to the limit. */
-  if (position > BUF_Z (buffer) || position < BUF_BEG (buffer))
-    abort ();
-
   /* Position Z is really one past the last char in the buffer.  */
   if (position == BUF_ZV (buffer))
     iposition = position - 1;