1
0

🔨」 fix(Phonebook): Fixed overflow and invalid command

This commit is contained in:
2024-11-04 10:45:04 +01:00
parent 1c5639df7b
commit 381dc87b02
2 changed files with 3 additions and 7 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/26 00:20:32 by adjoly #+# #+# */
/* Updated: 2024/11/03 18:50:17 by adjoly ### ########.fr */
/* Updated: 2024/11/04 10:43:35 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -29,10 +29,6 @@ PhoneBook::PhoneBook(void) {
this->_search();
else if (!input.compare("EXIT"))
return ;
else if (input.empty())
continue ;
else
std::cout << "Not a valid command" << std::endl;
}
}

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/31 13:51:00 by adjoly #+# #+# */
/* Updated: 2024/11/03 18:06:18 by adjoly ### ########.fr */
/* Updated: 2024/11/04 10:43:18 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -47,6 +47,6 @@ void PhoneBook::_add(void) {
return ;
this->_contact[this->_index].setSecret(input);
this->_index++;
if (this->_index >= 8)
if (this->_index > 7)
this->_index = 0;
}