Merge pull request #165 from BastiaanOlij/check_nullptr_on_bindingdata

Preventing crash when function returned null ptr
pull/179/head
Thomas Herzog 2018-08-05 08:43:35 +02:00 committed by GitHub
commit 12aeafd083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -633,7 +633,11 @@ def generate_icall_implementation(icalls):
if ret_type != "void":
if is_class_type(ret_type):
source.append("\treturn (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, ret);")
source.append("\tif (ret) {")
source.append("\t\treturn (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, ret);")
source.append("\t}")
source.append("")
source.append("\treturn (Object *) ret;")
else:
source.append("\treturn ret;")