Merge pull request #12064 from s-hadinger/lvgl_fix_warning

LVGL Fix warning when sending NULL instead of an instance
This commit is contained in:
s-hadinger 2021-05-09 23:16:10 +02:00 committed by GitHub
commit 0cabd00f66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -7,9 +7,6 @@
"type": "git", "type": "git",
"url": "https://github.com/lvgl/lvgl.git" "url": "https://github.com/lvgl/lvgl.git"
}, },
"build": {
"includeDir": "."
},
"license": "MIT", "license": "MIT",
"homepage": "https://lvgl.io", "homepage": "https://lvgl.io",
"frameworks": "*", "frameworks": "*",

View File

@ -310,7 +310,12 @@ int32_t be_convert_single_elt(bvm *vm, int32_t idx, const char * arg_type = null
// check if simple type was a match // check if simple type was a match
if (provided_type) { if (provided_type) {
if ((arg_type_len != 1) || ((arg_type[0] != provided_type) && arg_type[0] != '.') ) { bool type_ok = false;
type_ok = (arg_type[0] == '.'); // any type is accepted
type_ok = type_ok || (arg_type[0] == provided_type); // or type is a match
type_ok = type_ok || (ret == 0 && arg_type_len != 1); // or NULL is accepted for an instance
if (!type_ok) {
berry_log_P("Unexpected argument type '%c', expected '%s'", provided_type, arg_type); berry_log_P("Unexpected argument type '%c', expected '%s'", provided_type, arg_type);
} }
return ret; return ret;