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
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 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>();
}