diff src/vim9type.c @ 22804:af26fadf333d v8.2.1950

patch 8.2.1950: Vim9: crash when compiling function fails when getting type Commit: https://github.com/vim/vim/commit/9c13f76275047a4d6302c077fb40bc9c397ff027 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Nov 4 12:00:53 2020 +0100 patch 8.2.1950: Vim9: crash when compiling function fails when getting type Problem: Vim9: crash when compiling function fails when getting type. Solution: Handle NULL type. (closes https://github.com/vim/vim/issues/7253)
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 Nov 2020 12:15:03 +0100
parents 4c21f7f6f9e3
children a8bccb0634bc
line wrap: on
line diff
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -108,7 +108,7 @@ get_list_type(type_T *member_type, garra
     type_T *type;
 
     // recognize commonly used types
-    if (member_type->tt_type == VAR_ANY)
+    if (member_type == NULL || member_type->tt_type == VAR_ANY)
 	return &t_list_any;
     if (member_type->tt_type == VAR_VOID
 	    || member_type->tt_type == VAR_UNKNOWN)
@@ -137,7 +137,7 @@ get_dict_type(type_T *member_type, garra
     type_T *type;
 
     // recognize commonly used types
-    if (member_type->tt_type == VAR_ANY)
+    if (member_type == NULL || member_type->tt_type == VAR_ANY)
 	return &t_dict_any;
     if (member_type->tt_type == VAR_VOID
 	    || member_type->tt_type == VAR_UNKNOWN)
@@ -408,6 +408,7 @@ typval2type_vimvar(typval_T *tv, garray_
 
 /*
  * Return FAIL if "expected" and "actual" don't match.
+ * When "argidx" > 0 it is included in the error message.
  */
     int
 check_typval_type(type_T *expected, typval_T *actual_tv, int argidx)