add_trusted_domain() can return domain=NULL and we don't check this before calling set_routing_domain(NULL, ...) which will crash.
Patched in master. Backport for 4.8 attached to bug #13231.
Pushed to both 4-8-test, closing out bug report.