• Stuart Langley's avatar
    Prevent crash when removing a team drive to not be in the list of loaders. · 82e47566
    Stuart Langley authored
    This is a speculative fix for crash in drive::FileSystem::OnTeamDrivesChanged,
    that appears to be caused by passing an invalid iterator to map.erase().
    
    The change uses the key rather than in iterator, which will not crash if the key
    is not present.
    
    We have test coverage for this code path, but the fake_drive_service does not
    support us triggering this issue, which I think it a race between loading the
    initial list of team drives and processing the users first change list.
    Instead I added a unit test to ensure that removing a team drive id that is
    not in the map will not cause a crash.
    
    Bug: 881679
    Change-Id: I16f71f7984b5d4f7fed4cb9e939824fac1c813e8
    Reviewed-on: https://chromium-review.googlesource.com/1212371
    Commit-Queue: Stuart Langley <slangley@chromium.org>
    Reviewed-by: default avatarSam McNally <sammc@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#589448}
    82e47566
file_system.cc 45.7 KB