summaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-09 21:33:22 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-09 21:33:22 +0200
commit7b293c730b07d1586688e622b8d9cbbb4a52379b (patch)
tree0f90c26a7a77364ad11f2488536d79fa977d2bc1 /src/list.c
parent9c8bb7c0e251be2cca409055bd415266f57f013a (diff)
downloadvim-git-7b293c730b07d1586688e622b8d9cbbb4a52379b.tar.gz
patch 8.2.0539: comparing two NULL list failsv8.2.0539
Problem: Comparing two NULL list fails. Solution: Change the order of comparing two lists.
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/list.c b/src/list.c
index 9fe538414..451e58591 100644
--- a/src/list.c
+++ b/src/list.c
@@ -368,12 +368,15 @@ list_equal(
{
listitem_T *item1, *item2;
- if (l1 == NULL || l2 == NULL)
- return FALSE;
if (l1 == l2)
return TRUE;
if (list_len(l1) != list_len(l2))
return FALSE;
+ if (list_len(l1) == 0)
+ // empty and NULL list are considered equal
+ return TRUE;
+ if (l1 == NULL || l2 == NULL)
+ return FALSE;
range_list_materialize(l1);
range_list_materialize(l2);