Skip to content

Commit b576cbc

Browse files
authored
Fix issue when clearing a Lst<Mixed> in an upgraded file (#7806)
1 parent 8da33a3 commit b576cbc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
1010
* Valgrind could report a branch on an uninitialized read when opening something that is not an encrypted Realm file as an encrypted Realm file ([PR #7789](https://github.com/realm/realm-core/pull/7789), since v14.10.0).
1111
* Opening an FLX realm asynchronously may not wait to download all data ([#7720](https://github.com/realm/realm-core/issues/7720), since FLX sync was introduced).
12+
* Clearing a List of Mixed in an upgraded file would lead to an assertion failing ([#7771](https://github.com/realm/realm-core/issues/7771), since 14.0.0)
1213
* Fix compilation with Xcode 16 ([PR #7802](https://github.com/realm/realm-core/pull/7802))
1314

1415
### Breaking changes

src/realm/array_mixed.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ void ArrayMixed::clear()
215215
Array::set(payload_idx_int, 0);
216216
Array::set(payload_idx_pair, 0);
217217
Array::set(payload_idx_str, 0);
218-
Array::set(payload_idx_ref, 0);
218+
if (Array::size() > payload_idx_ref) {
219+
Array::set(payload_idx_ref, 0);
220+
}
219221
if (Array::size() > payload_idx_key) {
220222
if (auto ref = Array::get_as_ref(payload_idx_key)) {
221223
Array::destroy(ref, m_composite.get_alloc());

0 commit comments

Comments
 (0)