diff options
author | Damian Minkov <damencho@jitsi.org> | 2012-01-23 15:00:59 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2012-01-23 15:00:59 +0000 |
commit | 096047bbbe4cb202efba4d8a52c4c0d1940debcd (patch) | |
tree | 550890cd52d39e0ae51df93550251556d193e03f /src/net/java/sip/communicator | |
parent | 7c33e7645644abb473d88f1ce1c685439b6ec07d (diff) | |
download | jitsi-096047bbbe4cb202efba4d8a52c4c0d1940debcd.zip jitsi-096047bbbe4cb202efba4d8a52c4c0d1940debcd.tar.gz jitsi-096047bbbe4cb202efba4d8a52c4c0d1940debcd.tar.bz2 |
Fixes some possible NullPointerExceptions.
Diffstat (limited to 'src/net/java/sip/communicator')
3 files changed, 29 insertions, 17 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java index 7d610d9..3a3a392 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java @@ -742,12 +742,12 @@ public class ContactListTreeCellRenderer // check for phone stored in contact info only // if telephony contact is missing - if(uiContact.getContactNode().getContactDescriptor().getDescriptor() - instanceof MetaContact && telephonyContact == null) + if(uiContact.getDescriptor() != null + && uiContact.getDescriptor() instanceof MetaContact + && telephonyContact == null) { MetaContact metaContact = - (MetaContact)uiContact.getContactNode().getContactDescriptor(). - getDescriptor(); + (MetaContact)uiContact.getDescriptor(); Iterator<Contact> contacts = metaContact.getContacts(); while(contacts.hasNext() && !hasPhone) diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java index 224bcca..e238658 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java @@ -1181,7 +1181,7 @@ public class TreeContactList Component mouseComponent = renderer.findComponentAt(translatedX, translatedY); - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled() && mouseComponent != null) logger.debug("DISPATCH MOUSE EVENT TO COMPONENT: " + mouseComponent.getClass().getName() + " with bounds: " + mouseComponent.getBounds() diff --git a/src/net/java/sip/communicator/util/swing/plaf/SIPCommTextFieldUI.java b/src/net/java/sip/communicator/util/swing/plaf/SIPCommTextFieldUI.java index dd09d8b..fc5030c 100644 --- a/src/net/java/sip/communicator/util/swing/plaf/SIPCommTextFieldUI.java +++ b/src/net/java/sip/communicator/util/swing/plaf/SIPCommTextFieldUI.java @@ -179,19 +179,24 @@ public class SIPCommTextFieldUI Rectangle deleteButtonRect = getDeleteButtonRect(); - int dx = deleteButtonRect.x; - int dy = deleteButtonRect.y; - - if (c.getText() != null - && c.getText().length() > 0 - && isDeleteButtonEnabled) + if(deleteButtonRect != null) { - if (isDeleteMouseOver) - g2.drawImage(deleteButtonRolloverImg, dx, dy, null); + int dx = deleteButtonRect.x; + int dy = deleteButtonRect.y; + + if (c.getText() != null + && c.getText().length() > 0 + && isDeleteButtonEnabled) + { + if (isDeleteMouseOver) + g2.drawImage(deleteButtonRolloverImg, dx, dy, null); + else + g2.drawImage(deleteButtonImg, dx, dy, null); + + isDeleteIconVisible = true; + } else - g2.drawImage(deleteButtonImg, dx, dy, null); - - isDeleteIconVisible = true; + isDeleteIconVisible = false; } else isDeleteIconVisible = false; @@ -267,6 +272,9 @@ public class SIPCommTextFieldUI { JTextComponent c = getComponent(); + if(c == null) + return null; + Rectangle rect = c.getBounds(); int dx = rect.width - deleteButton.getWidth() - BUTTON_GAP - 5; @@ -292,6 +300,9 @@ public class SIPCommTextFieldUI } JTextComponent c = getComponent(); + + if(c == null) + return null; Rectangle alloc = c.getBounds(); @@ -439,7 +450,8 @@ public class SIPCommTextFieldUI private void updateCursor(MouseEvent mouseEvent) { - if (getVisibleEditorRect().contains(mouseEvent.getPoint())) + Rectangle rect = getVisibleEditorRect(); + if (rect != null && rect.contains(mouseEvent.getPoint())) { getComponent().setCursor( Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); |