Prevent using min and max on empty list