From 26a5703fb83a69189f8918466013b942bdea3519 Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Thu, 5 Dec 2013 12:27:01 +0200 Subject: [PATCH] Fixes StringIndexOutOfBoundsException when tab is pressed in the write panel in the chat room window to search for contact and the pattern is empty string. Patch provided by Danny van Heumen. --- .../communicator/impl/gui/main/chat/ChatWritePanel.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java index 294299883..84705969c 100755 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java @@ -614,7 +614,14 @@ else if(e.getKeyCode() == KeyEvent.VK_TAB) position++; String sequence = message.substring(position, index); - + + if (sequence.length() <= 0) + { + // Do not look for matching contacts if the matching pattern is + // 0 chars long, since all contacts will match. + return; + } + Iterator> iter = chatPanel.getChatSession() .getParticipants(); ArrayList contacts = new ArrayList();