Skip to content

Commit f3b6916

Browse files
committed
Merge pull request MasteringOpenCV#32 from SSteve/master
Check that the return value is nil before attempting to do anything with...
2 parents 8736df1 + 6d6167a commit f3b6916

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR

Chapter2_iPhoneAR/Example_MarkerBasedAR/Example_MarkerBasedAR/VideoSource.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ - (bool) startWithDevicePosition:(AVCaptureDevicePosition)devicePosition
146146
AVCaptureDeviceInput *videoIn = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
147147
self.deviceInput = videoIn;
148148

149-
if (!error)
149+
if (nil != videoIn)
150150
{
151151
if ([[self captureSession] canAddInput:videoIn])
152152
{
@@ -160,7 +160,7 @@ - (bool) startWithDevicePosition:(AVCaptureDevicePosition)devicePosition
160160
}
161161
else
162162
{
163-
NSLog(@"Couldn't create video input");
163+
NSLog(@"Couldn't create video input: %@", [error localizedDescription]);
164164
return FALSE;
165165
}
166166
}

0 commit comments

Comments
 (0)