Fixes #28436. Replaces a nullptr dereference (unguaranteed to cause a SEGFAULT) by `std::terminate` which will call the current `std::terminate_handler` and then SIGARBT.