-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash caused by null embedded objects when converting local realm to sync'd realm #6295
Fix crash caused by null embedded objects when converting local realm to sync'd realm #6295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the change is needed and legit.
@@ -52,6 +52,9 @@ void generate_properties_for_obj(Replication& repl, const Obj& obj, const ColInf | |||
auto embedded_table = elem.second; | |||
auto cols_2 = get_col_info(embedded_table); | |||
auto update_embedded = [&](Mixed val) { | |||
if (val.is_null()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so it seems we never really cater for this use case, we have always taken for granted the fact that the link could have never been NULL, I think this is the result of how we are masking invalid links. So I think this fix is correct.
test/object-store/realm.cpp
Outdated
@@ -1282,7 +1288,12 @@ TEST_CASE("SharedRealm: convert") { | |||
SECTION("can copy a synced realm to a synced realm") { | |||
auto sync_realm1 = Realm::get_shared_realm(sync_config1); | |||
sync_realm1->begin_transaction(); | |||
// 'embedded_link' property is null. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have added a separate test for covering this with a separate schema, but that's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What, How & Why?
Fix crash when converting local realm to sync'd realm if an embedded object is null.
Fixes #6294, realm-js#5389
☑️ ToDos
C-API, if public C++ API changed.