mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
return NULL in the case of incorrect camera index (ticket #710)
This commit is contained in:
parent
9170ff6f5e
commit
b58d9edc6a
@ -338,11 +338,10 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
|
||||
}
|
||||
|
||||
if (cameraNum >= 0) {
|
||||
camNum = cameraNum % [devices count];
|
||||
if (camNum != cameraNum) {
|
||||
cout << "Warning: Max Camera Num is " << [devices count]-1 << "; Using camera " << camNum << endl;
|
||||
}
|
||||
device = [devices objectAtIndex:camNum] ;
|
||||
int nCameras = [devices count];
|
||||
if( cameraNum < 0 || cameraNum >= nCameras )
|
||||
return 0;
|
||||
device = [devices objectAtIndex:cameraNum] ;
|
||||
} else {
|
||||
device = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo] ;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user