OSDN Git Service

Safeguard callback receiver to prevent crashes.
authorSascha Haeberling <haeberling@google.com>
Mon, 14 Apr 2014 21:41:57 +0000 (14:41 -0700)
committerSascha Haeberling <haeberling@google.com>
Mon, 14 Apr 2014 21:41:57 +0000 (14:41 -0700)
commit0fed7e62bfa0d8351b91d3531228a113637963a3
treecaa7337b91427a5b29d0bf4c06a65d35abf68bf7
parente08bc0428d3d5695d029f0b412d98db6ff8ac956
Safeguard callback receiver to prevent crashes.

  Bug: 13765929

It is safe to add these checks here. The receiver is only set in
the constructor, and it's only created in one place, which is
onCreate. And the parameter is the Activity itself, so it can
never be null.
This means the NPE can only happen if onCameraOpened is called after
removeCallbackReceiver is called, which is in onDestroy of the activity.
In this case it's safe to exit.

Change-Id: Ibffd6d54679b564a11b3e83319896241f2e306ad
src/com/android/camera/app/CameraController.java