From 30a9f5d5fa384087aaf22038698d080a3a90da41 Mon Sep 17 00:00:00 2001
From: Kamal Negi <kamaln@codeaurora.org>
Date: Wed, 30 Nov 2016 14:50:22 +0530
Subject: [PATCH] Check if string is null before adding to treeset

Checking if string is null before adding to treeset. Adding null string
to treeset will lead to a null pointer crash.

CRs-Fixed: 1095523
Change-Id: I74e1c6be3381c05c66ab697d82401da8e27badec
---
 fmapp2/src/com/caf/fmradio/FmSharedPreferences.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fmapp2/src/com/caf/fmradio/FmSharedPreferences.java b/fmapp2/src/com/caf/fmradio/FmSharedPreferences.java
index 2e2aa70..70a7d1c 100644
--- a/fmapp2/src/com/caf/fmradio/FmSharedPreferences.java
+++ b/fmapp2/src/com/caf/fmradio/FmSharedPreferences.java
@@ -342,7 +342,8 @@ public class FmSharedPreferences
       }
    }
    public static void addTags(int index, String s) {
-     if ((index >= 0) && (index <FmSharedPreferences.MAX_NUM_TAG_TYPES)) {
+     if ((index >= 0) && (index <FmSharedPreferences.MAX_NUM_TAG_TYPES) &&
+             s != null && !s.isEmpty()) {
           if(tagList[index] == null) {
              tagList[index] = new TreeSet<String>();
           }
-- 
GitLab