Skip to content

Commit

Permalink
Add null check for key milestone
Browse files Browse the repository at this point in the history
  • Loading branch information
jx124 committed Nov 8, 2023
1 parent 86a6e91 commit 7663905
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/seedu/address/storage/JsonAdaptedPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,15 @@ public Person toModelType() throws IllegalValueException {
final Set<Tag> modelTags = new HashSet<>(personTags);

if (type == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, "Type"));
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Type.class.getSimpleName()));
}
if (type.equals(TYPE_CLIENT)) {
return new Client(modelName, modelPhone, modelEmail, modelAddress, modelMeetingTime, modelTags);
} else if (type.equals(TYPE_LEAD)) {
if (keyMilestone == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT,
KeyMilestone.class.getSimpleName()));
}
if (!KeyMilestone.isValidKeyMilestone(keyMilestone)) {
throw new IllegalValueException(KeyMilestone.MESSAGE_CONSTRAINTS);
}
Expand Down

0 comments on commit 7663905

Please sign in to comment.