LuaBridge icon indicating copy to clipboard operation
LuaBridge copied to clipboard

Fix userdata nil bug

Open stefanfrings opened this issue 3 years ago • 0 comments

This fix prevents a segmentation fault in case a C++ function is called from Lua and nil instead of an object of a registered class is passed as parameter.

  • The get function correctly tests if nil is on the stack and returns a null pointer.
  • The bug is located in the StackHelper where the returned pointer is always dereferenced. This is the source of the undefined behavior/segmentation fault.

stefanfrings avatar Nov 26 '22 18:11 stefanfrings