Johnny Depp agreed to a multimillion-dollar settlement with his longtime entertainment lawyer, whom he accused in a lawsuit of illegally collecting more than $30 million in contingent fees without a written contract.

Bloom Hergott, the former firm of now-retired Jake Bloom, paid Depp a “massive 8-figure settlement to avoid the shame of evidence in their looming public trial,” according to Adam Waldman, an attorney representing Depp. A trial had been scheduled for December in Los Angeles.

An attorney for Bloom didn’t immediately respond to a request for comment on the settlement.

Depp, 56, is best known for playing Capt. Jack Sparrow in Walt Disney Co.’s “Pirates of the Caribbean” franchise. He went after his lawyer and his longtime business managers two years ago, accusing them of mishandling his affairs and leaving him stuck with a loan that sucked up all his movie residuals.

A judge’s ruling last year that an oral agreement under which Bloom received 5% of Depp’s income wasn’t enforceable caused an uproar in Hollywood, said Schuyler Moore, an entertainment lawyer with Greenberg Glusker in Los Angeles.

“So many actors, writers, and producers, have handshake deals with their lawyer,” Moore said in an interview. “That was a very important ruling even if you don’t normally expect a client to turn on his lawyer.”

The case is Depp v. Bloom Hergott Diemer Rosenthal LaViolettte Feldman Schenkman & Goodman LLP, BC680066, California Superior Court, Los Angeles County (Los Angeles).