Skip to content

Commit

Permalink
Add explicit check for null preview data.
Browse files Browse the repository at this point in the history
Fixes #268.
  • Loading branch information
rkistner committed Mar 20, 2017
1 parent 2cf4b60 commit 9ec92a5
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public void onPreviewFrame(byte[] data, Camera camera) {
PreviewCallback callback = this.callback;
if (cameraResolution != null && callback != null) {
try {
if(data == null) {
throw new NullPointerException("No preview data received");
}
int format = camera.getParameters().getPreviewFormat();
SourceData source = new SourceData(data, cameraResolution.width, cameraResolution.height, format, getCameraRotation());
callback.onPreview(source);
Expand Down

0 comments on commit 9ec92a5

Please sign in to comment.