diff --git a/CHANGELOG.md b/CHANGELOG.md index 349c52e3a75..f537899370f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) * 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). * 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). +* 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) * Fix compilation with Xcode 16 ([PR #7802](https://github.com/realm/realm-core/pull/7802)) ### Breaking changes diff --git a/src/realm/array_mixed.cpp b/src/realm/array_mixed.cpp index ae580988b26..ce84c635423 100644 --- a/src/realm/array_mixed.cpp +++ b/src/realm/array_mixed.cpp @@ -215,7 +215,9 @@ void ArrayMixed::clear() Array::set(payload_idx_int, 0); Array::set(payload_idx_pair, 0); Array::set(payload_idx_str, 0); - Array::set(payload_idx_ref, 0); + if (Array::size() > payload_idx_ref) { + Array::set(payload_idx_ref, 0); + } if (Array::size() > payload_idx_key) { if (auto ref = Array::get_as_ref(payload_idx_key)) { Array::destroy(ref, m_composite.get_alloc());