N.J. Stat. Ann. § 37:2-39
If a marriage or civil union is determined to be void, an agreement that would otherwise have been a premarital or pre-civil union agreement is enforceable only to the extent necessary to avoid an inequitable result.
L.1988, c.99; amended 2006, c.103, s.34.