From 85800b64a184e7bcc93c5a044b74559cee618245 Mon Sep 17 00:00:00 2001 From: Maciej Kisielewski Date: Tue, 21 Sep 2021 11:26:10 +0200 Subject: Fix: graceful exit on no supported camera res This patch makes the test exit with a graceful message instaed of a backtrace when no supported resolution could be found. --- bin/camera_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/camera_test.py b/bin/camera_test.py index 37e97d9..a7740f4 100755 --- a/bin/camera_test.py +++ b/bin/camera_test.py @@ -248,6 +248,8 @@ class CameraTest: supported_resolutions[key] = set() supported_resolutions[key].add( caps.get_structure(i).get_int('height').value) + if not supported_resolutions: + raise SystemExit("No supported resolutions found!") width = min(supported_resolutions.keys(), key=lambda x: abs(x - self._width)) height = min(supported_resolutions[width], -- cgit v1.2.3