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

Commit f715de6b authored by calderwoodra's avatar calderwoodra Committed by Eric Erfanian
Browse files

Fixed NPE in CameraComposerFragment.

If a user took a picture then quickly closed call composer, when the image was
ready we would try to update our view state. Since our fragment is no longer
attached, this cuases a crash when we check that getContext() is not null.

fragment.getContext is never null in robolectric.
Bug: 62687110
Test: manual, cannot test b/c we cannot take photos in Espresso and
PiperOrigin-RevId: 161600278
Change-Id: If9bd98578d221fca4bc99ff17a39f917f3a8bcca
parent 9ea21240
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -332,7 +332,11 @@ public class CameraComposerFragment extends CallComposerFragment
  /** Updates the state of the buttons and overlays based on the current state of the view */
  private void updateViewState() {
    Assert.isNotNull(cameraView);
    Assert.isNotNull(getContext());
    if (isDetached() || getContext() == null) {
      LogUtil.i(
          "CameraComposerFragment.updateViewState", "Fragment detached, cannot update view state");
      return;
    }

    boolean isCameraAvailable = CameraManager.get().isCameraAvailable();
    boolean uriReadyOrProcessing = cameraUri != null || processingUri;