tools: Add null check for struct ptrs in CToCpp wrapper (see #3836)

This commit is contained in:
Marshall Greenblatt
2025-02-18 10:20:03 -05:00
parent 4261816c34
commit 64bb2aadd5

View File

@ -102,6 +102,10 @@ def make_ctocpp_function_impl_new(cls, name, func, base_scoped, version,
result += '\n auto* _struct = reinterpret_cast<'+\ result += '\n auto* _struct = reinterpret_cast<'+\
func.parent.get_capi_name(version=version)+'*>(GetStruct());' func.parent.get_capi_name(version=version)+'*>(GetStruct());'
result += '\n if (!_struct->' + func.get_capi_name() + ') {'\
'\n return' + retval_default + ';'\
'\n }\n'
# add API hash check # add API hash check
if func.has_attrib('api_hash_check'): if func.has_attrib('api_hash_check'):
result += '\n const char* api_hash = cef_api_hash(CEF_API_VERSION, 0);'\ result += '\n const char* api_hash = cef_api_hash(CEF_API_VERSION, 0);'\