I’m going to take a closer look at this implementation today, but first thing to note is that this test doesn’t actually generate the crash at #41925. I haven’t checked yet to see whether your changes do in fact fix that crash, but it seems like the test doesn’t actually prove that the linked bug is fixed.