Bug 474 (mainBreak)

Summary: Program crash on inputs with incorrect arguments
Product: Group 4 Reporter: kykao2-c
Component: MainAssignee: sharitsang97
Status: CONFIRMED ---    
Severity: critical    
Priority: Highest    
Version: unspecified   
Hardware: Macintosh   
OS: Mac OS   
Deadline: 2020-11-26   
Attachments: Program crashed upon incorrect inputs

Description kykao2-c 2020-11-26 11:25:33 HKT
Created attachment 50 [details]
Program crashed upon incorrect inputs

The program is immediately crashed upon an incorrect input on my 2017 13-ich Macbook Pro (OS: macOS Mojave; version 10.14.6). This error causes the program unable to operate properly for normal usage.

Severity: Critical. 

Specification of the device which encountered this problem:
MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)
Processor: 2.3 GHz Intel Core i5
Memory: 16 GB 2133 MHz LPDDR3
Graphics: Intel Iris Plus Graphics 640 1536 MB

The inputs leading to program crash are as follows:
1. "ListMember" (incorrect command - correct: "listMember")
2. "makePurchase 10" (incorrect input arguments)
3. "randomCommand" (command that does not exist)

Observation:
The program crashes if the input does not match the correct ones coded in the program; the failure-causing inputs passed to parameters cannot be executed correctly and lead to an exception.

Solution:
An input checking mechanism can be implemented for avoiding failure-causing input to break the program. For example, check if the input fulfils the size of arguments to be passed as well as to ensure it returns a error message to the user without passing such input for retry instead.