Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8c9337b authored by Jay Shrauner's avatar Jay Shrauner
Browse files

Handle null returns from insertChild

insertChild() returns null whenever kind is null. Don't crash in these cases.

Bug:12490438
Change-Id: Idf1cd8fa9d6dfe6a2f91f3ff656663f0692f4a3f
(cherry picked from commit f54c9f2c)
parent 49a9c120
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2066,6 +2066,7 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen
                    GroupMembership.CONTENT_ITEM_TYPE);
            final ValuesDelta entry = RawContactModifier.insertChild(rawContactEntityDelta,
                    groupMembershipKind);
            if (entry == null) return;
            entry.setGroupRowId(defaultGroupId);

            // and fire off the intent. we don't need a callback, as the database listener
+3 −1
Original line number Diff line number Diff line
@@ -369,9 +369,11 @@ public class GroupMembershipView extends LinearLayout
            long groupId = item.getGroupId();
            if (item.isChecked() && !hasMembership(groupId)) {
                ValuesDelta entry = RawContactModifier.insertChild(mState, mKind);
                if (entry != null) {
                    entry.setGroupRowId(groupId);
                }
            }
        }

        updateView();
    }
+3 −1
Original line number Diff line number Diff line
@@ -391,10 +391,12 @@ public class RawContactEditorView extends BaseRawContactEditorView {
            long defaultGroupId = getDefaultGroupId();
            if (defaultGroupId != -1) {
                ValuesDelta entry = RawContactModifier.insertChild(mState, mGroupMembershipKind);
                if (entry != null) {
                    entry.setGroupRowId(defaultGroupId);
                }
            }
        }
    }

    /**
     * Returns the default group (e.g. "My Contacts") for the current raw contact's