From 8865cc406c893dcdb167ab3d89ce5d2c668c2799 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Mon, 17 Nov 2014 17:31:26 +0100 Subject: [PATCH] trim search before searching --- src/main/java/eu/siacs/conversations/entities/Contact.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 0b6c900a1..a451c142a 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -145,10 +145,10 @@ public class Contact implements ListItem { } public boolean match(String needle) { - if (needle == null) { + if (needle == null || needle.isEmpty()) { return true; } - needle = needle.toLowerCase(); + needle = needle.toLowerCase().trim(); String[] parts = needle.split("\\s+"); if (parts.length > 1) { for(int i = 0; i < parts.length; ++i) {