No act of a nonprofit corporation and no conveyance or transfer of real or personal property to or by a nonprofit corporation shall be invalid by reason of the fact that the corporation was without capacity of power to do an act or to make or receive a conveyance or transfer, but lack of capacity of power may be asserted:
(1) In a proceeding by a member or a director against the nonprofit corporation to enjoin the doing or continuation of unauthorized acts, or the transfer of real or personal property by or to the nonprofit corporation. If the unauthorized acts or transfer sought to be enjoined are being, or are to be, performed pursuant to any contract to which the nonprofit corporation is a party, the court may, if all of the parties to the contract are parties to the proceeding and if it deems the same to be equitable, set aside and enjoin the performance of the contract, and in so doing may allow to the nonprofit corporation or the other parties to the contract, as the case may be, compensation for the loss or damage sustained by either of them which may result from the action of the court in setting aside and enjoining the performance of the contract, but anticipated profits to be derived from the performance of the contract shall not be awarded by the court as a loss or damage sustained.
(2) In a proceeding by the nonprofit corporation, whether acting directly or through a receiver, trustee, or other legal representative, or through members in a representative suit, against the officers or directors of the nonprofit corporation for exceeding their authority.
(3) In a proceeding by the Attorney General, as provided in this chapter, to dissolve the nonprofit corporation, or in a proceeding by the Attorney General to enjoin the nonprofit corporation from performing unauthorized acts, or in any other proceeding by the Attorney General.