[PATCH v4l-utils] v4l2-compliance: fix assert on only read/write-only controls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the driver only contains read-only (or write-only) controls,
total_vec is empty. In that case return immediately instead of
trying to access total_vec[0].

Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
---
 utils/v4l2-compliance/v4l2-test-controls.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp
index 735bc5a13c09..2a3f64e8bbec 100644
--- a/utils/v4l2-compliance/v4l2-test-controls.cpp
+++ b/utils/v4l2-compliance/v4l2-test-controls.cpp
@@ -749,6 +749,8 @@ int testExtendedControls(struct node *node)
 			multiple_classes = true;
 		total_vec.push_back(ctrl);
 	}
+	if (total_vec.empty())
+		return 0;
 
 	ctrls.count = total_vec.size();
 	ctrls.controls = &total_vec[0];
-- 
2.20.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux