Noticed when trying to fix PR23380. I think it's better to assert than segfaulting one line below.
Discussed with dexonsmith on IRC.