Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Merge 88d4953 into e7f43d3
Browse files Browse the repository at this point in the history
  • Loading branch information
yamidark committed Jan 20, 2018
2 parents e7f43d3 + 88d4953 commit 4f72e46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main/java/seedu/address/storage/XmlAdaptedPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,22 @@ public Person toModelType() throws IllegalValueException {
personTags.add(tag.toModelType());
}

if (!Name.isValidName(this.name)) {
if (this.name != null && !Name.isValidName(this.name)) {
throw new IllegalValueException(Name.MESSAGE_NAME_CONSTRAINTS);
}
final Name name = new Name(this.name);

if (!Phone.isValidPhone(this.phone)) {
if (this.phone != null && !Phone.isValidPhone(this.phone)) {
throw new IllegalValueException(Phone.MESSAGE_PHONE_CONSTRAINTS);
}
final Phone phone = new Phone(this.phone);

if (!Email.isValidEmail(this.email)) {
if (this.email != null && !Email.isValidEmail(this.email)) {
throw new IllegalValueException(Email.MESSAGE_EMAIL_CONSTRAINTS);
}
final Email email = new Email(this.email);

if (!Address.isValidAddress(this.address)) {
if (this.address != null && !Address.isValidAddress(this.address)) {
throw new IllegalValueException(Address.MESSAGE_ADDRESS_CONSTRAINTS);
}
final Address address = new Address(this.address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import javax.xml.bind.annotation.XmlElement;
Expand Down Expand Up @@ -53,7 +54,7 @@ public ObservableList<Person> getPersonList() {
//TODO: better error handling
return null;
}
}).collect(Collectors.toCollection(FXCollections::observableArrayList));
}).filter(Objects::nonNull).collect(Collectors.toCollection(FXCollections::observableArrayList));
return FXCollections.unmodifiableObservableList(persons);
}

Expand Down

0 comments on commit 4f72e46

Please sign in to comment.