]> git.mxchange.org Git - jaddressbook-share-lib.git/blobdiff - Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java
Introduced more methods + added first dialog call (yes, it is still visible by startu...
[jaddressbook-share-lib.git] / Addressbook / src / org / mxchange / addressbook / manager / contact / ContactManager.java
index 62bcfbd484c678bdfe1095beedc0dfd655572557..f502e1e3daef2001ddb543f90fdf2eea557392af 100644 (file)
@@ -237,8 +237,11 @@ public class ContactManager extends BaseManager implements ManageableContact {
                // 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
@@ -474,6 +477,12 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @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
@@ -484,9 +493,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
                }
 
                // 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);