From adc04ad52474113e5a540b33fbefd389b861a89f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 3 Mar 2023 19:13:03 -0500 Subject: [PATCH] * src/intervals.c (set_intervals_multibyte_1): Fix bug#61887 When `total_length` is 0 there should be no subtree at all, but `delete_interval` only deletes one interval, so make sure we don't end up with some stale child of `i`. --- src/intervals.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intervals.c b/src/intervals.c index 75e37a8c90c..ee976fb1035 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -2333,6 +2333,9 @@ set_intervals_multibyte_1 (INTERVAL i, bool multi_flag, if (TOTAL_LENGTH (i) == 0) { + /* Delete the whole subtree. */ + i->left = NULL; + i->right = NULL; delete_interval (i); return; } -- 2.39.2