PS5NorModifier
PS5NorModifier copied to clipboard
Passing "exit" into option 8 of the sub menu does not hit the exit case
repro steps:
Launch sub menu select option 8 Pass "exit"
Expected result: exit case is hit, we break out of the loop Actual result: "The new model you entered is invalid. The model should be 9 characters long starting with 'CFI-', followed by 4 numbers and a letter." and we cycle through the loop again.
The reason is due to the following set of if statements (line 1338 - 1354 of Program.cs):
if (string.IsNullOrEmpty(newModel))
{
// The user did not enter a valid string
System.Console.WriteLine("Please enter a valid model number to continue...");
} else if (newModel.Length < 9)
{
// The entered model is an invalid length
System.Console.WriteLine("The new model you entered is invalid. The model should be 9 characters long starting with 'CFI-', followed by 4 numbers and a letter.");
}else if (!newModel.StartsWith("CFI-"))
{
System.Console.WriteLine("The new model you entered is invalid. The model should be 9 characters long starting with 'CFI-', followed by 4 numbers and a letter.");
}else if (newModel == "exit")
{
// The user wants to exit this menu
isDone = true;
break;
}
the given value "exit" gets caught in the else if (newModel.Length < 9) and never hits the if (newModel == "exit") statement
Fix - move the exit clause above the Length < 9 clause.