mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-21 11:25:08 +03:00
qcam: Don't crash if camera can't be opened
If the camera specified on the command line can't be opened, the MainWindow constructor still proceeds to check the startStopAction_, which results in MainWindow::startCapture() being called and trying to use a null camera_ object. Fix this by returning from the constructor as soon as the error is detected. This also fixes a similar crash if the camera selection dialog box is closed without selecting a camera. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <email@uajain.com>
This commit is contained in:
parent
de30b6127c
commit
96980e35ae
1 changed files with 3 additions and 1 deletions
|
@ -70,8 +70,10 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)
|
|||
|
||||
/* Open the camera and start capture. */
|
||||
ret = openCamera();
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
quit();
|
||||
return;
|
||||
}
|
||||
|
||||
startStopAction_->setChecked(true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue