Skip to content

Commit 2a8fc52

Browse files
committed
Don't throw for empty tag keys
1 parent 54fb095 commit 2a8fc52

File tree

1 file changed

+8
-4
lines changed
  • OneSignalSDK/onesignal/core/src/main/java/com/onesignal/user/internal

1 file changed

+8
-4
lines changed

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/user/internal/UserManager.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ internal open class UserManager(
166166
Logging.log(LogLevel.DEBUG, "setTag(key: $key, value: $value)")
167167

168168
if (key.isEmpty()) {
169-
throw Exception("Cannot add tag with empty key")
169+
Logging.log(LogLevel.ERROR, "Cannot add tag with empty key")
170+
return
170171
}
171172

172173
_propertiesModel.tags[key] = value
@@ -177,7 +178,8 @@ internal open class UserManager(
177178

178179
tags.forEach {
179180
if (it.key.isEmpty()) {
180-
throw Exception("Cannot add tag with empty key")
181+
Logging.log(LogLevel.ERROR, "Cannot add tag with empty key")
182+
return
181183
}
182184
}
183185

@@ -190,7 +192,8 @@ internal open class UserManager(
190192
Logging.log(LogLevel.DEBUG, "removeTag(key: $key)")
191193

192194
if (key.isEmpty()) {
193-
throw Exception("Cannot remove tag with empty key")
195+
Logging.log(LogLevel.ERROR, "Cannot remove tag with empty key")
196+
return
194197
}
195198

196199
_propertiesModel.tags.remove(key)
@@ -201,7 +204,8 @@ internal open class UserManager(
201204

202205
keys.forEach {
203206
if (it.isEmpty()) {
204-
throw Exception("Cannot remove tag with empty key")
207+
Logging.log(LogLevel.ERROR, "Cannot remove tag with empty key")
208+
return
205209
}
206210
}
207211

0 commit comments

Comments
 (0)