Merge "[2nd attempt] Fix crash due to inconsistent handling of CR" into main