For joint credit agreements (a joint loan, joint mortgage, joint credit card, joint bank overdraft), each party is 'jointly and severally' liable. That means the creditor can chase either of you for the whole balance, regardless of any private agreement between you.
A financial order made by the divorce court can require your ex to pay a debt — but if they don't, the creditor will still come after you. You'd then have to enforce the divorce order against them separately.
The cleanest solutions are to close joint accounts, transfer debts into one person's sole name (subject to the lender's agreement), or, if that isn't possible, plan around the assumption that you may become responsible for the whole balance.
Related reading
Debts After Death
Who pays debts after someone dies
The estate pays. Not the family. Understanding the exceptions matters.
ReadDebts After Death
Which debts die with the person
Not every debt survives the estate. Some end automatically, others become the estate's responsibility.
ReadDebts After Redundancy
The first steps after losing your job
The first two weeks matter more than the following two months. What to do, in what order.
ReadDebts After Redundancy
Using redundancy pay wisely
A lump sum feels like a solution, but the order in which you use it matters.
Read