summaryrefslogtreecommitdiff
path: root/src/qcam/main_window.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-04-29 14:40:35 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-05-01 12:24:07 +0200
commitdee99d47267e9d9204884b2ff798cd02eb5914f2 (patch)
tree9e274e924f1949964809cd2800678d9fbfe3dd95 /src/qcam/main_window.cpp
parentd29c32135709b18f430b75b8f9fc2592a5915149 (diff)
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>
Diffstat (limited to 'src/qcam/main_window.cpp')
-rw-r--r--src/qcam/main_window.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index 74427592..b9348111 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -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);