Mercurial > vim
diff src/vim9class.c @ 31517:cd5247f4da06 v9.0.1091
patch 9.0.1091: assignment to non-existing member causes a crash
Commit: https://github.com/vim/vim/commit/f54cedd6763e7727b4bfaeb34bb7c365a17675eb
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 23 17:56:27 2022 +0000
patch 9.0.1091: assignment to non-existing member causes a crash
Problem: Assignment to non-existing member causes a crash. (Yegappan
Lakshmanan)
Solution: Give an error message and bail out when a member cannot be found.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 23 Dec 2022 19:00:04 +0100 |
parents | 560ba934725f |
children | 8bbc932fbd09 |
line wrap: on
line diff
--- a/src/vim9class.c +++ b/src/vim9class.c @@ -569,8 +569,9 @@ cleanup: } /* - * Find member "name" in class "cl" and return its type. - * When not found t_any is returned. + * Find member "name" in class "cl", set "member_idx" to the member index and + * return its type. + * When not found "member_idx" is set to -1 and t_any is returned. */ type_T * class_member_type( @@ -591,6 +592,8 @@ class_member_type( return m->ocm_type; } } + + semsg(_(e_unknown_variable_str), name); return &t_any; }