From 2b8cc9dd66a2825e36c672a04a795a8689dfac9f Mon Sep 17 00:00:00 2001 From: pchmn Date: Fri, 5 May 2017 14:28:15 +0200 Subject: [PATCH] Fixed bug related with issue #7 --- .../com/pchmn/materialchips/adapter/FilterableAdapter.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java index 68b91519..90d536c6 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java @@ -70,6 +70,13 @@ public int compare(ChipInterface o1, ChipInterface o2) { return mCollator.compare(o1.getLabel(), o2.getLabel()); } }; + // remove chips that do not have label + int count = 0; + for(ChipInterface chipInterface: chipList) { + if(chipInterface.getLabel() == null) + chipList.remove(count); + count++; + } sortList(chipList); mOriginalList.addAll(chipList); mChipList.addAll(chipList);