Hotfix: Avoid crashes on branch switches
See 24acff13f8ca66c43b2fb518758459db4635615c for more info
Note: Skip this patch when merging into 5.0
FIXED-IN: 1.7.4 BUG: 365884