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 7d610d9ae..3a3a39297 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 @@ private void initButtonsPanel(UIContact uiContact) // 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 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 224bcca28..e23865803 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 @@ private void dispatchEventToButtons(MouseEvent event) 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 dd09d8b79..fc5030cca 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 @@ protected void customPaintBackground(Graphics g) 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 @@ protected Rectangle getDeleteButtonRect() { 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 @@ protected Rectangle getVisibleEditorRect() } JTextComponent c = getComponent(); + + if(c == null) + return null; Rectangle alloc = c.getBounds(); @@ -439,7 +450,8 @@ public void mouseMoved(MouseEvent e) 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));