Skip to content

Commit a5c88de

Browse files
authored
Merge pull request #1849 from OneSignal/fix/concurrent_modification_exception
Fix concurrent modification exception
2 parents bb041ad + 3402c6d commit a5c88de

File tree

1 file changed

+2
-1
lines changed
  • OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/modeling

1 file changed

+2
-1
lines changed

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/modeling/Model.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.onesignal.common.events.IEventNotifier
55
import org.json.JSONArray
66
import org.json.JSONObject
77
import java.math.BigDecimal
8+
import java.util.*
89

910
/**
1011
* The base class for a [Model]. A model is effectively a map of data, each key in the map being
@@ -61,7 +62,7 @@ open class Model(
6162
get() = getStringProperty(::id.name)
6263
set(value) { setStringProperty(::id.name, value) }
6364

64-
protected val data: MutableMap<String, Any?> = mutableMapOf()
65+
protected val data: MutableMap<String, Any?> = Collections.synchronizedMap(mutableMapOf())
6566
private val _changeNotifier = EventProducer<IModelChangedHandler>()
6667

6768
init {

0 commit comments

Comments
 (0)