Fix crash seen in ROOT-5570.