It sounds like the order meant you had to stay on the mortgage but would be indemnified against arrears if she failed to pay it.
An order of this sort would normally have an end date i.e. youngest child reaching a certain age (usually 18/21). There would also be other conditions such as the arrangement ending on remarriage and the need for your ex to use best endeavours to remove you from the mortgage. This would mean they have to make regular applications to see if they can obtain a mortgage to cover the whole amount owed. Without being sure they can afford it (and this means meeting lending criteria) the lender will not release you.
If the mortgage was not paid, the lender would still chase you for the money. You may have to pay but the court order you have means you could get it back from your ex.
Check the exact terms of the order and let us know what it says.