Fix crash when toggling selections in an empty list