Add try catch

Make sure the program doesn’t break with invalid design