d00 ex01 correction erreur affichage index en cas de simple retour a la ligne
This commit is contained in:
@@ -133,7 +133,7 @@ void PhoneBook::search_contact() {
|
||||
if (!std::getline(std::cin, index))
|
||||
return;
|
||||
id = std::strtol(index.c_str(), &ret, 10);
|
||||
if (*ret || id < 0 || id > this->_contact_count - 1 || id > 7)
|
||||
if (*ret || index.empty() || id < 0 || id > _contact_count - 1 || id > 7)
|
||||
std::cout << B_RED "sorry, not a valid index" RESET << std::endl;
|
||||
else
|
||||
break;
|
||||
|
||||
BIN
d00/ex01/phonebook
Executable file
BIN
d00/ex01/phonebook
Executable file
Binary file not shown.
Reference in New Issue
Block a user