Fix a bug introduced in Synapse 1.58.0 where `/sync` would fail if the most recent event in a room was rejected.