HaxeFoundation / hxcpp

Runtime files for c++ backend for haxe
Other
297 stars 189 forks source link

The interface did not perform a null check. #1137

Closed rainyt closed 3 months ago

rainyt commented 3 months ago
::Dynamic display = null();
::game::display::base::IDisplay_obj::getX(display)

interface IDisplay  {
  public function getX():Float;
}

var display:IDisplay = null;
display.getX();

C++ code:

static inline Float getX( ::Dynamic _hx_) {
    return (_hx_.mPtr->*( ::hx::interface_cast< ::IDisplay_obj *>(_hx_.mPtr->_hx_getInterface(0xd7fddcf9)))->_hx_getX)();
}

Hi, All:

HXCPP_CHECK_POINTER Does it have no effect on this? In this case, a crash will inevitably occur on the hxcpp target. Is there a way to prevent it from crashing?

Is there any way for me to add null check support to it?

@hughsando

rainyt commented 3 months ago

I understand that this is an issue with the haxe compiler, close it.