Update to support None
[ldk-java] / src / main / java / org / ldk / structs / CommitmentUpdate.java
index d886689d383bb0b8865dd1ec7c01d54175b54c8a..a5de9e9d07b0cf0001ed8ac2e295d6642e9053ae 100644 (file)
@@ -11,7 +11,7 @@ public class CommitmentUpdate extends CommonBase {
        }
 
        public CommitmentUpdate(CommitmentUpdate orig) {
-               super(bindings.CommitmentUpdate_clone(orig.ptr & ~1));
+               super(bindings.CommitmentUpdate_clone(orig == null ? 0 : orig.ptr & ~1));
                this.ptrs_to.add(orig);
        }
 
@@ -20,25 +20,25 @@ public class CommitmentUpdate extends CommonBase {
        // Skipped CommitmentUpdate_set_update_fail_htlcs
        // Skipped CommitmentUpdate_set_update_fail_malformed_htlcs
        public UpdateFee get_update_fee(CommitmentUpdate this_ptr) {
-               UpdateFee ret = new UpdateFee(null, bindings.CommitmentUpdate_get_update_fee(this_ptr.ptr & ~1));
+               UpdateFee ret = new UpdateFee(null, bindings.CommitmentUpdate_get_update_fee(this_ptr == null ? 0 : this_ptr.ptr & ~1));
                this.ptrs_to.add(this_ptr);
                return ret;
        }
 
        public void set_update_fee(CommitmentUpdate this_ptr, UpdateFee val) {
-               bindings.CommitmentUpdate_set_update_fee(this_ptr.ptr & ~1, val.ptr & ~1);
+               bindings.CommitmentUpdate_set_update_fee(this_ptr == null ? 0 : this_ptr.ptr & ~1, val == null ? 0 : val.ptr & ~1);
                this.ptrs_to.add(this_ptr);
                this.ptrs_to.add(val);
        }
 
        public CommitmentSigned get_commitment_signed(CommitmentUpdate this_ptr) {
-               CommitmentSigned ret = new CommitmentSigned(null, bindings.CommitmentUpdate_get_commitment_signed(this_ptr.ptr & ~1));
+               CommitmentSigned ret = new CommitmentSigned(null, bindings.CommitmentUpdate_get_commitment_signed(this_ptr == null ? 0 : this_ptr.ptr & ~1));
                this.ptrs_to.add(this_ptr);
                return ret;
        }
 
        public void set_commitment_signed(CommitmentUpdate this_ptr, CommitmentSigned val) {
-               bindings.CommitmentUpdate_set_commitment_signed(this_ptr.ptr & ~1, val.ptr & ~1);
+               bindings.CommitmentUpdate_set_commitment_signed(this_ptr == null ? 0 : this_ptr.ptr & ~1, val == null ? 0 : val.ptr & ~1);
                this.ptrs_to.add(this_ptr);
                this.ptrs_to.add(val);
        }