summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2021-04-14 15:47:27 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2021-04-21 20:05:21 +0200
commitb2cc8a2f57333f8aa818a7eb519124ce4594b8a2 (patch)
treee8b646bf72ae4f1fbcf33e3e60499bcd6faedab6
parente58b5fa39f1e4b6d86ebc40cdf17d7dc9030e661 (diff)
lc-compliance: simple_capture: Handle unsupported roles
It's valid for a camera to return a nullptr if the requested set of roles can not be satisfied. This is not correctly handled by lc-compliance which instead crashes, fix this. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
-rw-r--r--src/lc-compliance/simple_capture.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lc-compliance/simple_capture.cpp b/src/lc-compliance/simple_capture.cpp
index 811a6220..64e862a0 100644
--- a/src/lc-compliance/simple_capture.cpp
+++ b/src/lc-compliance/simple_capture.cpp
@@ -23,6 +23,9 @@ Results::Result SimpleCapture::configure(StreamRole role)
{
config_ = camera_->generateConfiguration({ role });
+ if (!config_)
+ return { Results::Skip, "Role not supported by camera" };
+
if (config_->validate() != CameraConfiguration::Valid) {
config_.reset();
return { Results::Fail, "Configuration not valid" };