From 9993fe5a54e458965128b324a6600d94423ea588 Mon Sep 17 00:00:00 2001 From: Rudy Ges Date: Thu, 1 Aug 2024 07:16:27 +0200 Subject: [PATCH] [cpp] Null Check Interfaces (#11743) --- src/generators/gencpp.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/generators/gencpp.ml b/src/generators/gencpp.ml index 8156bfe837c..1223398673f 100644 --- a/src/generators/gencpp.ml +++ b/src/generators/gencpp.ml @@ -4719,6 +4719,7 @@ let gen_member_def ctx class_def is_static is_interface field = let cast = "::hx::interface_cast< ::" ^ join_class_path_remap class_def.cl_path "::" ^ "_obj *>" in output (" " ^ returnType ^ " (::hx::Object :: *_hx_" ^ remap_name ^ ")(" ^ argList ^ "); \n"); output (" static inline " ^ returnType ^ " " ^ remap_name ^ "( ::Dynamic _hx_" ^ commaArgList ^ ") {\n"); + output (" if (::hx::IsNull(_hx_)) ::hx::NullReference(\"Object\", false); \n"); output (" " ^ returnStr ^ "(_hx_.mPtr->*( " ^ cast ^ "(_hx_.mPtr->_hx_getInterface(" ^ (cpp_class_hash class_def) ^ ")))->_hx_" ^ remap_name ^ ")(" ^ cpp_arg_names args ^ ");\n }\n" ); end | _ -> ( )