If a marriage is determined to be void, a premarital agreement or marital agreement is enforceable to the extent necessary to avoid an inequitable result.