From be8ceb2652d061db359575671e9df6b5b0128c8e Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Sat, 4 Feb 2023 14:06:14 +0100 Subject: [PATCH] Modified error handling. The error for invalid input for forename and surname when creating a new customer account is caught. --- src/createCustomer.c | 9 ++++++++- src/error.c | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/createCustomer.c b/src/createCustomer.c index d6226ee..e3a9920 100644 --- a/src/createCustomer.c +++ b/src/createCustomer.c @@ -31,10 +31,14 @@ void collectCustomerProperties() } if(inputTooLong){ errorMessage(-7); - }else{ + } + else{ *(instance.forename+letterCounter) = '\0'; letterCounter = 0; } + if(!isLetterOfAlphabet(instance.forename)){ + errorMessage(-10); + } printf("Enter surname (max. 15 letters):\n"); while(letterCounter