0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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.
This commit is contained in:
Bram Moolenaar
2023-02-18 14:42:44 +00:00
parent 9de960ace0
commit 0917e86763
10 changed files with 94 additions and 48 deletions

View File

@@ -2270,6 +2270,20 @@ typedef enum {
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 @@ typedef enum {
#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