mirror of https://github.com/arendst/Tasmota.git
Berry Improve error message when constructor returns NULL (#20314)
This commit is contained in:
parent
77a58a3642
commit
3415453620
|
@ -399,7 +399,7 @@ int be_check_arg_type(bvm *vm, int arg_start, int argc, const char * arg_type, i
|
||||||
// `+` forbids any NULL value (raises an exception) while `=` allows a NULL value
|
// `+` forbids any NULL value (raises an exception) while `=` allows a NULL value
|
||||||
static void be_set_ctor_ptr(bvm *vm, void * ptr, const char *name) {
|
static void be_set_ctor_ptr(bvm *vm, void * ptr, const char *name) {
|
||||||
if (name == NULL) return; // do nothing if no name of attribute
|
if (name == NULL) return; // do nothing if no name of attribute
|
||||||
if (name[0] == '+' && ptr == NULL) { be_raise(vm, "value_error", "argument cannot be NULL"); }
|
if (name[0] == '+' && ptr == NULL) { be_raise(vm, "value_error", "native constructor cannot return NULL"); }
|
||||||
if (name[0] == '+' || name[0] == '=') { name++; } // skip prefix '^' if any
|
if (name[0] == '+' || name[0] == '=') { name++; } // skip prefix '^' if any
|
||||||
if (strlen(name) == 0) return; // do nothing if name is empty
|
if (strlen(name) == 0) return; // do nothing if name is empty
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue