patch 9.0.1320: checking the type of a null object causes a crash
Problem: Checking the type of a null object causes a crash.
Solution: Don't try to get the class of a null object. (closes #12005)
Handle error from calling a user function better.
diff --git a/src/vim.h b/src/vim.h
index 67bb23e..45b5fa9 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2270,6 +2270,20 @@
KEYPROTOCOL_FAIL
} keyprot_T;
+// errors for when calling a function
+typedef enum {
+ FCERR_NONE, // no error
+ FCERR_UNKNOWN, // unknown function
+ FCERR_TOOMANY, // too many arguments
+ FCERR_TOOFEW, // too few arguments
+ FCERR_SCRIPT, // missing script context
+ FCERR_DICT, // missing dict
+ FCERR_OTHER, // another kind of error
+ FCERR_DELETED, // function was deleted
+ FCERR_NOTMETHOD, // function cannot be used as a method
+ FCERR_FAILED, // error while executing the function
+} funcerror_T;
+
// Flags for assignment functions.
#define ASSIGN_VAR 0 // ":var" (nothing special)
#define ASSIGN_FINAL 0x01 // ":final"
@@ -2703,17 +2717,6 @@
#define DO_NOT_FREE_CNT 99999 // refcount for dict or list that should not
// be freed.
-// errors for when calling a function
-#define FCERR_UNKNOWN 0
-#define FCERR_TOOMANY 1
-#define FCERR_TOOFEW 2
-#define FCERR_SCRIPT 3
-#define FCERR_DICT 4
-#define FCERR_NONE 5
-#define FCERR_OTHER 6
-#define FCERR_DELETED 7
-#define FCERR_NOTMETHOD 8 // function cannot be used as a method
-
// fixed buffer length for fname_trans_sid()
#define FLEN_FIXED 40