diff --git a/CHANGELOG.md b/CHANGELOG.md index ebf4d901..28729406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,13 @@ - Updated the Twilio Voice iOS SDK dependency to `6.12.1`. +## Fixes + +### Platform Specific Fixes + +#### Android + +- Fix thread safety issue in the `CallRecordDatabase` 1.3.0 (Dec 10, 2024) ==================== diff --git a/android/src/main/java/com/twiliovoicereactnative/CallRecordDatabase.java b/android/src/main/java/com/twiliovoicereactnative/CallRecordDatabase.java index eba3ac73..ac43d27c 100644 --- a/android/src/main/java/com/twiliovoicereactnative/CallRecordDatabase.java +++ b/android/src/main/java/com/twiliovoicereactnative/CallRecordDatabase.java @@ -157,14 +157,18 @@ public void clear() { public CallRecord get(final CallRecord record) { try { - return callRecordList.get(callRecordList.indexOf(record)); + synchronized (callRecordList) { + return callRecordList.get(callRecordList.indexOf(record)); + } } catch (IndexOutOfBoundsException e) { return null; } } public CallRecord remove(final CallRecord record) { try { - return callRecordList.remove(callRecordList.indexOf(record)); + synchronized (callRecordList) { + return callRecordList.remove(callRecordList.indexOf(record)); + } } catch (IndexOutOfBoundsException e) { return null; }