In considering whether any amount is to be retained or recovered by any party to a discharged contract, the court must not take into account any amounts payable to a party under a contract of insurance because of the circumstances giving rise to the frustration or avoidance of the contract unless an obligation to insure is imposed—
(a) by an express provision in the frustrated or avoided contract; or
(b) by or under any enactment.