At least in `Event::PaymentPathFailed` if we try to map an event
with no `retry` we'll hit a `NullPointerException` as we'll try to
add a reference from the `null` retry back to the `Event` itself.
The simple fix is to simply exhaustively check for `null` before
adding references everywhere.
return var + ".ptr" + " = 0;"
def add_ref(self, holder, referent):
- return holder + ".ptrs_to.add(" + referent + ")"
+ return "if (" + holder + " != null) { " + holder + ".ptrs_to.add(" + referent + "); }"
def fully_qualified_hu_ty_path(self, ty):
if ty.java_fn_ty_arg.startswith("L") and ty.java_fn_ty_arg.endswith(";"):
// In TypeScript, protected means "any subclass can access parent fields on instances of itself"
// To work around this, we add accessors for other instances' protected fields here.
protected static add_ref_from(holder: CommonBase, referent: object) {
- holder.ptrs_to.push(referent);
+ if (holder !== null) { holder.ptrs_to.push(referent); }
}
protected static get_ptr_of(o: CommonBase) {
return o.ptr;