// Deligate this call to the client
Contact contact = this.getClient().doEnterOwnData();
- // Add it to contact "book"
- this.registerContact(contact);
+ // Is it set?
+ if (contact instanceof Contact) {
+ // Add it to contact "book"
+ this.registerContact(contact);
+ }
}
@Override
*/
@Override
public void registerContact (final Contact contact) {
+ // Sanity check
+ if (contact == null) {
+ // Abort here
+ throw new NullPointerException("contact is null");
+ }
+
// Check if contact is found
if (this.isContactAlreadyAdded(contact)) {
// Contact already added
}
// Debug message
- /*
- * NOISY-DEBUG:
- */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getSurname(), contact.getFamilyName(), this.size()));
+ /* NOISY-DEBUG: */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getSurname(), contact.getFamilyName(), this.size()));
// Add contact to internal list
this.addContact(contact);