Use AutoCloseable for structs named Locked*
[ldk-java] / src / main / java / org / ldk / structs / RoutingFees.java
index 215372fa7e71112bdef675084713fb4091c63af9..80183bb91bfb1b7508f22d4538aa6883891ba9a5 100644 (file)
@@ -7,33 +7,34 @@ public class RoutingFees extends CommonBase {
        RoutingFees(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.RoutingFees_free(ptr); super.finalize();
+               super.finalize();
+               bindings.RoutingFees_free(ptr);
        }
 
        public RoutingFees(RoutingFees orig) {
-               super(bindings.RoutingFees_clone(orig.ptr & ~1));
+               super(bindings.RoutingFees_clone(orig == null ? 0 : orig.ptr & ~1));
                this.ptrs_to.add(orig);
        }
 
        public int get_base_msat(RoutingFees this_ptr) {
-               int ret = bindings.RoutingFees_get_base_msat(this_ptr.ptr & ~1);
+               int ret = bindings.RoutingFees_get_base_msat(this_ptr == null ? 0 : this_ptr.ptr & ~1);
                this.ptrs_to.add(this_ptr);
                return ret;
        }
 
        public void set_base_msat(RoutingFees this_ptr, int val) {
-               bindings.RoutingFees_set_base_msat(this_ptr.ptr & ~1, val);
+               bindings.RoutingFees_set_base_msat(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
                this.ptrs_to.add(this_ptr);
        }
 
        public int get_proportional_millionths(RoutingFees this_ptr) {
-               int ret = bindings.RoutingFees_get_proportional_millionths(this_ptr.ptr & ~1);
+               int ret = bindings.RoutingFees_get_proportional_millionths(this_ptr == null ? 0 : this_ptr.ptr & ~1);
                this.ptrs_to.add(this_ptr);
                return ret;
        }
 
        public void set_proportional_millionths(RoutingFees this_ptr, int val) {
-               bindings.RoutingFees_set_proportional_millionths(this_ptr.ptr & ~1, val);
+               bindings.RoutingFees_set_proportional_millionths(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
                this.ptrs_to.add(this_ptr);
        }