Passing nullptr to functions with nullable parameter (`*parent = nullptr`) crashes
For this kind of interface:

```cpp
TreeItem *create_item(TreeItem *parent = nullptr, int32_t idx = -1);
```

Current `binding_generator.py` generates implementation like below:

```cpp
TreeItem *Tree::create_item(TreeItem *parent, int32_t idx) {
    /* ... snip ... */
    return internal::_call_native_mb_ret_obj<TreeItem>(___method_bind, _owner, parent->_owner, &idx_encoded);
}
```

When you actually call this function with the default argument, it crashes at `parent->_owner` because `parent` is `nullptr`.
If I change `parent->_owner` to `parent ? parent->_owner : nullptr`, then it is working.

I noticed this bug when I was using `TreeItem`, but I think this issue also affects other classes with similar interfaces too. I assume the script should generate different code for nullable parameters. 

EDIT: Theoretically, there might be some other cases where the function has a nullable pointer parameter without default value, but I'm not sure how many of godot-cpp's API matches that form.

Relevant location:
https://github.com/godotengine/godot-cpp/blob/bffedfed1eb297b697fa4d139ac9d03b5c9fabd6/binding_generator.py#L1499-L1501


diff --git a/binding_generator.py b/binding_generator.py
index c1e2a69..6294fd5 100644
--- a/binding_generator.py
+++ b/binding_generator.py
@@ -1587,7 +1587,9 @@ def get_encoded_arg(arg_name, type_name, type_meta):
         result.append(f"\\tPtrToArg<{correct_type(type_name)}>::encode({name}, &{name}_encoded);")
         name = f"&{name}_encoded"
     elif is_engine_class(type_name):
-        name = f"{name}->_owner"
+        # `{name}` is a C++ wrapper, it contains a field which is the object's pointer Godot expects.
+        # We have to check `nullptr` because when the caller sends `nullptr`, the wrapper itself will be null.
+        name = f"({name} != nullptr ? {name}->_owner : nullptr)"
     else:
         name = f"&{name}"
 
['binding_generator.py']