qcam: Check that camera can generate configuration from roles
If the camera can not generate a configuration from the requested roles it returns a nullptr which leads to a nullptr dereference. Fix this by adding a check that the camera generated a configuration before trying to access it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -296,6 +296,10 @@ int MainWindow::startCapture()
|
||||
|
||||
/* Configure the camera. */
|
||||
config_ = camera_->generateConfiguration(roles);
|
||||
if (!config_) {
|
||||
qWarning() << "Failed to generate configuration from roles";
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
StreamConfiguration &cfg = config_->at(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user