Fix crash on invalid rotation