Fix potential UB in rP24312
Reported by: Vladislav
Differential Revision: https://code.wildfiregames.com/D3180