[iOS] Stop loading Drive file picker items once disconnected This CL returns early when loading Drive file picker items if the object used to fetch items is unavailable, which means the mediator was disconnected. Change-Id: I3535f7553a292743408ec48c908154203df6616c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5928669 Commit-Queue: Olivier Robin <olivierrobin@chromium.org> Commit-Queue: Quentin Pubert <qpubert@google.com> Reviewed-by: Olivier Robin <olivierrobin@chromium.org> Auto-Submit: Quentin Pubert <qpubert@google.com> Cr-Commit-Position: refs/heads/main@{#1368263}
diff --git a/ios/chrome/browser/drive_file_picker/coordinator/drive_file_picker_mediator.mm b/ios/chrome/browser/drive_file_picker/coordinator/drive_file_picker_mediator.mm index d04047d..99d3e99e 100644 --- a/ios/chrome/browser/drive_file_picker/coordinator/drive_file_picker_mediator.mm +++ b/ios/chrome/browser/drive_file_picker/coordinator/drive_file_picker_mediator.mm
@@ -737,6 +737,11 @@ - (void)loadItemsAppending:(BOOL)append delayed:(BOOL)delayed animated:(BOOL)animated { + if (!_driveList) { + // When disconnected, do nothing. + return; + } + // If there is a timer programmed to fetch items, cancel it. _fetchTimer.Stop(); // Cancel any pending fetch query.