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:
Niklas Söderlund
2020-04-29 14:40:35 +02:00
parent d29c321357
commit dee99d4726

View File

@@ -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);