@@ -73,7 +73,9 @@ struct PyBody{
PyBody(): body(nullptr), fixture(nullptr), node_like(nullptr){}
void _gc_mark() {
- PK_OBJ_MARK(node_like);
+ if(node_like != nullptr){
+ PK_OBJ_MARK(node_like);
+ }
}
PyBody& _() { return *this; }
@@ -128,7 +128,7 @@ void PyBody::_register(VM* vm, PyObject* mod, PyObject* type){
// destroy
vm->bind(type, "destroy(self)", [](VM* vm, ArgsView args){
- PyBody& body = CAST(PyBody&, args[1]);
+ PyBody& body = CAST(PyBody&, args[0]);
body.body->GetWorld()->DestroyBody(body.body);
body.body = nullptr;
body.fixture = nullptr;