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>
This commit is contained in:
Niklas Söderlund
2021-04-14 15:47:27 +02:00
parent e58b5fa39f
commit b2cc8a2f57

View File

@@ -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" };