From e4f0e74e47ebd17c4ba0049342b73a1e97031c03 Mon Sep 17 00:00:00 2001 From: Benoit Pradelle Date: Wed, 29 Oct 2008 00:58:21 +0000 Subject: [PATCH] Fix a null pointer exception if the user cancel a color pickup --- .../main/chat/toolBars/EditTextToolBar.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java index 95bf4f895..aba5e3071 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java @@ -203,18 +203,20 @@ public void mousePressed(MouseEvent event) "Choose a colour", colorLabel.getBackground()); - colorLabel.setBackground(newColor); - - ActionEvent evt = - new ActionEvent(chatEditorPane, - ActionEvent.ACTION_PERFORMED, ""); - - Action action = - new HTMLEditorKit.ForegroundAction(new Integer(newColor - .getRGB()).toString(), newColor); - - action.actionPerformed(evt); - + if (newColor != null) { + colorLabel.setBackground(newColor); + + ActionEvent evt = + new ActionEvent(chatEditorPane, + ActionEvent.ACTION_PERFORMED, ""); + + Action action = + new HTMLEditorKit.ForegroundAction(new Integer(newColor + .getRGB()).toString(), newColor); + + action.actionPerformed(evt); + } + chatEditorPane.requestFocus(); } });