dictitem_T *item2;
int todo;
+ if (d1 == NULL && d2 == NULL)
+ return TRUE;
if (d1 == NULL || d2 == NULL)
return FALSE;
if (d1 == d2)
char_u *tofree = NULL;
hashitem_T *hi;
+ if (d == NULL)
+ return NULL;
if (len < 0)
akey = key;
else if (len >= AKEYLEN)
char_u buf[NUMBUFLEN];
char_u **curval;
char_u **curallocval;
- int len = argvars[1].vval.v_list->lv_len;
+ list_T *ll = argvars[1].vval.v_list;
listitem_T *li;
+ int len;
+
+ /* If the list is NULL handle like an empty list. */
+ len = ll == NULL ? 0 : ll->lv_len;
/* First half: use for pointers to result lines; second half: use for
* pointers to allocated copies. */
allocval = lstval + len + 2;
curallocval = allocval;
- for (li = argvars[1].vval.v_list->lv_first; li != NULL;
+ for (li = ll == NULL ? NULL : ll->lv_first; li != NULL;
li = li->li_next)
{
strval = get_tv_string_buf_chk(&li->li_tv, buf);
call assert_true(0, 'should not get here')
endfor
endfunc
+
+func Test_compare_null_dict()
+ call assert_fails('let x = test_null_dict()[10]')
+ call assert_equal({}, {})
+ call assert_equal(test_null_dict(), test_null_dict())
+ call assert_notequal({}, test_null_dict())
+endfunc
+
+func Test_set_reg_null_list()
+ call setreg('x', test_null_list())
+endfunc