Mercurial > vim
changeset 32017:b4e5d28b788c v9.0.1340
patch 9.0.1340: Coverity warns for using NULL pointer
Commit: https://github.com/vim/vim/commit/666cb9c5303753fef7039e9a9e5fbe9a44299607
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 22 12:35:17 2023 +0000
patch 9.0.1340: Coverity warns for using NULL pointer
Problem: Coverity warns for using NULL pointer.
Solution: Check that lhs_type is not NULL.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 22 Feb 2023 13:45:04 +0100 |
parents | 3eaebd299742 |
children | 125e0ccf3725 |
files | src/version.c src/vim9compile.c |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1340, +/**/ 1339, /**/ 1338,
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -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))