A court order can be a lawful excuse for non-performance of a contract, but it's not always the case. The specifics of the contract, the court order, and the jurisdiction matter.
Thank you.