]> granicus.if.org Git - vim/commitdiff
patch 9.0.1340: Coverity warns for using NULL pointer v9.0.1340
authorBram Moolenaar <Bram@vim.org>
Wed, 22 Feb 2023 12:35:17 +0000 (12:35 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 22 Feb 2023 12:35:17 +0000 (12:35 +0000)
Problem:    Coverity warns for using NULL pointer.
Solution:   Check that lhs_type is not NULL.

src/version.c
src/vim9compile.c

index 12e5fa107a6e4f7cbc7944f612ccfd54320c4334..c541e6f7ff81dfdf3d62a55a8957c142364cfb9b 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1340,
 /**/
     1339,
 /**/
index d45dd63a185f5ec534517a492f9a7d6dcae7b80d..64526aa9d3ea01d8dafcf5fa11b6ac1f6248146c 100644 (file)
@@ -1848,8 +1848,9 @@ compile_lhs(
            lhs->lhs_type = &t_any;
        }
 
-       int use_class = lhs->lhs_type->tt_type == VAR_CLASS
-                                      || lhs->lhs_type->tt_type == VAR_OBJECT;
+       int use_class = lhs->lhs_type != NULL
+                           && (lhs->lhs_type->tt_type == VAR_CLASS
+                                      || lhs->lhs_type->tt_type == VAR_OBJECT);
        if (lhs->lhs_type == NULL
                || (use_class ? lhs->lhs_type->tt_class == NULL
                                           : lhs->lhs_type->tt_member == NULL))