Skip to content

Commit

Permalink
Merge pull request MasteringOpenCV#32 from SSteve/master
Browse files Browse the repository at this point in the history
Check that the return value is nil before attempting to do anything with...
  • Loading branch information
BloodAxe committed Jun 2, 2014
2 parents 8736df1 + 6d6167a commit f3b6916
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ - (bool) startWithDevicePosition:(AVCaptureDevicePosition)devicePosition
AVCaptureDeviceInput *videoIn = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
self.deviceInput = videoIn;

if (!error)
if (nil != videoIn)
{
if ([[self captureSession] canAddInput:videoIn])
{
Expand All @@ -160,7 +160,7 @@ - (bool) startWithDevicePosition:(AVCaptureDevicePosition)devicePosition
}
else
{
NSLog(@"Couldn't create video input");
NSLog(@"Couldn't create video input: %@", [error localizedDescription]);
return FALSE;
}
}
Expand Down

0 comments on commit f3b6916

Please sign in to comment.