Merge pull request #117 from TheBlueMatt/2022-08-fix-npe
[ldk-java] / src / main / java / org / ldk / structs / Balance.java
index e6957ac2602e9d5900b0aceb0eb65852662c5852..c2106e76cca9839e4e87e36fec9ab0bf37118118 100644 (file)
@@ -138,7 +138,7 @@ public class Balance extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -150,7 +150,7 @@ public class Balance extends CommonBase {
                Reference.reachabilityFence(claimable_amount_satoshis);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -163,7 +163,7 @@ public class Balance extends CommonBase {
                Reference.reachabilityFence(confirmation_height);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -176,7 +176,7 @@ public class Balance extends CommonBase {
                Reference.reachabilityFence(timeout_height);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -189,7 +189,7 @@ public class Balance extends CommonBase {
                Reference.reachabilityFence(claimable_height);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -198,7 +198,7 @@ public class Balance extends CommonBase {
         * This ignores pointers and is_owned flags and looks at the values in fields.
         */
        public boolean eq(Balance b) {
-               boolean ret = bindings.Balance_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+               boolean ret = bindings.Balance_eq(this.ptr, b == null ? 0 : b.ptr);
                Reference.reachabilityFence(this);
                Reference.reachabilityFence(b);
                return ret;