diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-12-27 11:54:37 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-27 11:54:37 +0000 |
commit | 23018f2d4b6f85512af117d346eee9b14a4637a6 (patch) | |
tree | e318e99efc20c222cdbebd1a6e38aa730bd01aba /src/list.c | |
parent | bbdd3fb804bf69684f7b0f49d3c0a0b039daec02 (diff) | |
download | vim-git-23018f2d4b6f85512af117d346eee9b14a4637a6.tar.gz |
patch 8.2.3910: when compare function of sort() fails it does not abortv8.2.3910
Problem: When the compare function of sort() produces and error then sort()
does not abort.
Solution: Check if did_emsg was incremented.
Diffstat (limited to 'src/list.c')
-rw-r--r-- | src/list.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/list.c b/src/list.c index 6fafef637..838991b73 100644 --- a/src/list.c +++ b/src/list.c @@ -1919,6 +1919,7 @@ item_compare2(const void *s1, const void *s2) char_u *func_name; partial_T *partial = sortinfo->item_compare_partial; funcexe_T funcexe; + int did_emsg_before = did_emsg; // shortcut after failure in previous call; compare all items equal if (sortinfo->item_compare_func_err) @@ -1946,7 +1947,7 @@ item_compare2(const void *s1, const void *s2) clear_tv(&argv[0]); clear_tv(&argv[1]); - if (res == FAIL) + if (res == FAIL || did_emsg > did_emsg_before) res = ITEM_COMPARE_FAIL; else { |