Appeal from a judgment of the Supreme Court in favor of defendant, entered February 5, 1979 in Albany County, upon a dismissal of the complaint by the court at a Trial Term, at the close of plaintiff’s case. By a contract executed on February 4, 1972, plaintiff agreed to build a sewage treatment plant for defendant. The contract provided in pertinent part as follows: "All damage to life or property * * * resulting to the work during its progress from whatever cause * * * shall be borne and sustained by the Contractor and all work *958shall be solely at his risk until it has been finally inspected and accepted.” On June 29, 1973 a flood caused extensive damage to the largely completed project. On that date no inspection and acceptance by defendant had yet occurred. Plaintiff, under protest, assumed the cost of repairs and, when defendant refused to reimburse plaintiff, the instant action was commenced. After plaintiff had presented its proof the court dismissed the complaint. This appeal ensued. Under these circumstances plaintiff is entitled to the benefit of every favorable inference that can reasonably be drawn from the evidence (Brisette v New York City Tr. Auth., 45 AD2d 960). Additionally, such a dismissal is proper only if there is no rational process by which the jury could have found for the plaintiff (Blum v Fresh Grown Preserve Corp., 292 NY 241, 245). Plaintiff initially contends that since the work has been substantially completed there was a performance of the contract. We disagree. Concededly, certain painting work had not been completed prior to the flood damage. The contract specifically and unambiguously places the obligation to pay for damages to the property during its progress on the contractor. It is a well-established rule that when one of two innocent persons must sustain a loss, the law casts it upon him who has agreed to sustain it (Tompkins v Dudley, 25 NY 272; Warren Bros. Co. Div., Ashland Oil & Refining Co. v State of New York, 59 AD2d 1039). That the contract was substantially performed is immaterial (Tompkins v Dudley, supra; 10 NY Jur, Contracts, § 366, p 352). We also reject plaintiff’s contention that defendant’s failure to inspect the completed work was wrongful, resulting in the flood damages sustained by plaintiff. The record clearly reveals that plaintiff had not finished all of the work required by the original contract until January, 1974. Furthermore, it was unforeseeable when the contract was made that a delay in completion of the project would lead to the risk of loss still being on plaintiff when the flood occurred. Consequently, defendant was not responsible for the damages caused by the flood (see Motif Constr. Corp. v Buffalo Sav. Bank, 50 AD2d 718, 719). We have considered all other arguments advanced by plaintiff urging reversal and find them unpersuasive. The judgment should be affirmed. Judgment affirmed, with costs. Greenblott, J. P., Sweeney, Kane, Staley, Jr., and Casey, JJ., concur.