diff --git a/libraries/AP_Scripting/generator/src/main.c b/libraries/AP_Scripting/generator/src/main.c index faca5ca96e..f5759f6b48 100644 --- a/libraries/AP_Scripting/generator/src/main.c +++ b/libraries/AP_Scripting/generator/src/main.c @@ -1330,7 +1330,7 @@ void emit_userdata_method(const struct userdata *data, const struct method *meth // extract the userdata, it was a pointer, so we need to grab it fprintf(source, " %s * ud = *check_%s(L, 1);\n", data->name, data->sanatized_name); fprintf(source, " if (ud == NULL) {\n"); - fprintf(source, " luaL_error(L, \"Internal error, null pointer\");\n"); + fprintf(source, " return luaL_error(L, \"Internal error, null pointer\");\n"); fprintf(source, " }\n"); break; } diff --git a/libraries/AP_Scripting/lua_generated_bindings.cpp b/libraries/AP_Scripting/lua_generated_bindings.cpp index 7e678f8fbc..1e4b572b1a 100644 --- a/libraries/AP_Scripting/lua_generated_bindings.cpp +++ b/libraries/AP_Scripting/lua_generated_bindings.cpp @@ -2519,7 +2519,7 @@ static int AP_HAL__UARTDriver_set_flow_control(lua_State *L) { binding_argcheck(L, 2); AP_HAL::UARTDriver * ud = *check_AP_HAL__UARTDriver(L, 1); if (ud == NULL) { - luaL_error(L, "Internal error, null pointer"); + return luaL_error(L, "Internal error, null pointer"); } const lua_Integer raw_data_2 = luaL_checkinteger(L, 2); luaL_argcheck(L, ((raw_data_2 >= static_cast(AP_HAL::UARTDriver::FLOW_CONTROL_DISABLE)) && (raw_data_2 <= static_cast(AP_HAL::UARTDriver::FLOW_CONTROL_AUTO))), 2, "argument out of range"); @@ -2534,7 +2534,7 @@ static int AP_HAL__UARTDriver_available(lua_State *L) { binding_argcheck(L, 1); AP_HAL::UARTDriver * ud = *check_AP_HAL__UARTDriver(L, 1); if (ud == NULL) { - luaL_error(L, "Internal error, null pointer"); + return luaL_error(L, "Internal error, null pointer"); } const uint32_t data = ud->available(); @@ -2547,7 +2547,7 @@ static int AP_HAL__UARTDriver_write(lua_State *L) { binding_argcheck(L, 2); AP_HAL::UARTDriver * ud = *check_AP_HAL__UARTDriver(L, 1); if (ud == NULL) { - luaL_error(L, "Internal error, null pointer"); + return luaL_error(L, "Internal error, null pointer"); } const lua_Integer raw_data_2 = luaL_checkinteger(L, 2); luaL_argcheck(L, ((raw_data_2 >= MAX(0, 0)) && (raw_data_2 <= MIN(UINT8_MAX, UINT8_MAX))), 2, "argument out of range"); @@ -2564,7 +2564,7 @@ static int AP_HAL__UARTDriver_read(lua_State *L) { binding_argcheck(L, 1); AP_HAL::UARTDriver * ud = *check_AP_HAL__UARTDriver(L, 1); if (ud == NULL) { - luaL_error(L, "Internal error, null pointer"); + return luaL_error(L, "Internal error, null pointer"); } const int16_t data = ud->read(); @@ -2576,7 +2576,7 @@ static int AP_HAL__UARTDriver_begin(lua_State *L) { binding_argcheck(L, 2); AP_HAL::UARTDriver * ud = *check_AP_HAL__UARTDriver(L, 1); if (ud == NULL) { - luaL_error(L, "Internal error, null pointer"); + return luaL_error(L, "Internal error, null pointer"); } const uint32_t raw_data_2 = coerce_to_uint32_t(L, 2); luaL_argcheck(L, ((raw_data_2 >= MAX(1U, 0U)) && (raw_data_2 <= MIN(UINT32_MAX, UINT32_MAX))), 2, "argument out of range");