Add a double-check for null SurfaceHolder

git-svn-id: https://zxing.googlecode.com/svn/trunk@2258 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-04-25 11:51:45 +00:00
parent 8c924b470f
commit 26d5ff4355

View file

@ -721,6 +721,9 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
}
private void initCamera(SurfaceHolder surfaceHolder) {
if (surfaceHolder == null) {
throw new IllegalStateException("No SurfaceHolder provided");
}
try {
cameraManager.openDriver(surfaceHolder);
// Creating the handler starts the preview, which can also throw a RuntimeException.