diff --git a/uniffi_bindgen/src/bindings/swift/templates/ObjectTemplate.swift b/uniffi_bindgen/src/bindings/swift/templates/ObjectTemplate.swift index c42c50803e..5079d7f68b 100644 --- a/uniffi_bindgen/src/bindings/swift/templates/ObjectTemplate.swift +++ b/uniffi_bindgen/src/bindings/swift/templates/ObjectTemplate.swift @@ -63,6 +63,10 @@ open class {{ impl_class_name }}: {%- endmatch %} deinit { + guard let pointer else { + return + } + try! rustCall { {{ obj.ffi_object_free().name() }}(pointer, $0) } }