fix(clangd): check size of array before applying qsort on it

This commit is contained in:
sus-domesticus 2024-01-02 22:43:55 +02:00
parent 91d76ac941
commit 1027ccac6d

View File

@ -240,7 +240,9 @@ void win_float_remove(bool bang, int count)
for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) {
kv_push(float_win_arr, wp);
}
qsort(float_win_arr.items, float_win_arr.size, sizeof(win_T *), float_zindex_cmp);
if (float_win_arr.size > 0) {
qsort(float_win_arr.items, float_win_arr.size, sizeof(win_T *), float_zindex_cmp);
}
for (size_t i = 0; i < float_win_arr.size; i++) {
if (win_close(float_win_arr.items[i], false, false) == FAIL) {
break;