]> granicus.if.org Git - vim/commitdiff
patch 7.4.1567 v7.4.1567
authorBram Moolenaar <Bram@vim.org>
Tue, 15 Mar 2016 12:33:55 +0000 (13:33 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 15 Mar 2016 12:33:55 +0000 (13:33 +0100)
Problem:    Crash in assert_fails().
Solution:   Check for NULL. (Dominique Pelle)  Add a test.

src/eval.c
src/testdir/test_assert.vim
src/version.c

index fd028ccce611645babd62613ce989ff90915d5db..7776cc6c33ec68c1aaf750ee3e430a2bdd9ebfd4 100644 (file)
@@ -9386,7 +9386,8 @@ f_assert_fails(typval_T *argvars, typval_T *rettv UNUSED)
        char_u  buf[NUMBUFLEN];
        char    *error = (char *)get_tv_string_buf_chk(&argvars[1], buf);
 
-       if (strstr((char *)vimvars[VV_ERRMSG].vv_str, error) == NULL)
+       if (error == NULL
+                 || strstr((char *)vimvars[VV_ERRMSG].vv_str, error) == NULL)
        {
            prepare_assert_error(&ga);
            fill_assert_error(&ga, &argvars[2], NULL, &argvars[1],
index df2636d7bc3c374c579f27d64704f6ccaefea684..2ac828b282f946a644f2d2a487185e453d2208fd 100644 (file)
@@ -62,6 +62,12 @@ func Test_compare_fail()
   endtry
 endfunc
 
+func Test_assert_fail_fails()
+  call assert_fails('xxx', {})
+  call assert_true(v:errors[0] =~ "Expected {} but got 'E731:")
+  call remove(v:errors, 0)
+endfunc
+
 
 func Test_user_is_happy()
   smile
index e4004f81c3e65b1b8e2962501d03f0a2b88d21a5..eecbfe1ed2486e1114831cf0ce18236614316107 100644 (file)
@@ -743,6 +743,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1567,
 /**/
     1566,
 /**/