summaryrefslogtreecommitdiff
path: root/src/itree.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-11-01 21:38:55 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2022-11-01 21:39:12 -0400
commit8a5678906fa1b899c4d111e5ee4334b278f50d48 (patch)
tree37a1266d9a21cdccb9dcf220e680c23f2576c7f2 /src/itree.c
parent835295381bdee3d517c7ee243a22640c78783a9f (diff)
downloademacs-8a5678906fa1b899c4d111e5ee4334b278f50d48.tar.gz
src/buffer.c: Fix interaction between overlays & indirect buffers (bug#58928)
* src/buffer.c (adjust_overlays_for_insert) (adjust_overlays_for_delete): Repeat for all buffers sharing the same text. * src/itree.c (itree_insert_gap, itree_delete_gap): Allow an empty tree. * test/src/buffer-tests.el (buffer-tests--overlays-indirect-bug58928): New test.
Diffstat (limited to 'src/itree.c')
-rw-r--r--src/itree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/itree.c b/src/itree.c
index 3b10802ff09..bd4e8cc5740 100644
--- a/src/itree.c
+++ b/src/itree.c
@@ -1196,7 +1196,7 @@ void
itree_insert_gap (struct itree_tree *tree,
ptrdiff_t pos, ptrdiff_t length)
{
- if (length <= 0 || tree->root == NULL)
+ if (!tree || length <= 0 || tree->root == NULL)
return;
uintmax_t ootick = tree->otick;
@@ -1280,7 +1280,7 @@ void
itree_delete_gap (struct itree_tree *tree,
ptrdiff_t pos, ptrdiff_t length)
{
- if (length <= 0 || tree->root == NULL)
+ if (!tree || length <= 0 || tree->root == NULL)
return;
/* FIXME: Don't allocate stack anew every time. */