From: Martin Tůma <martin.tuma@xxxxxxxxxxxxxxxxxxxxx> When a v4l2 driver implements VIDIOC_ENUM_FRAMESIZES for an output, qv4l2 crashes on accessing the "frame size widget" that does not exist. This patch adds a proper check for the widget not being NULL. Signed-off-by: Martin Tůma <martin.tuma@xxxxxxxxxxxxxxxxxxxxx> --- utils/qv4l2/general-tab.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/utils/qv4l2/general-tab.cpp b/utils/qv4l2/general-tab.cpp index ffa44eca..bceaab09 100644 --- a/utils/qv4l2/general-tab.cpp +++ b/utils/qv4l2/general-tab.cpp @@ -2165,13 +2165,16 @@ void GeneralTab::updateFrameSize() ok = !enum_framesizes(frmsize, m_pixelformat); if (ok && frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) { - do { - m_frameSize->addItem(QString("%1x%2") - .arg(frmsize.discrete.width).arg(frmsize.discrete.height)); - if (frmsize.discrete.width == m_width && - frmsize.discrete.height == m_height) - m_frameSize->setCurrentIndex(frmsize.index); - } while (!enum_framesizes(frmsize)); + if (m_frameSize) { + do { + m_frameSize->addItem(QString("%1x%2") + .arg(frmsize.discrete.width) + .arg(frmsize.discrete.height)); + if (frmsize.discrete.width == m_width && + frmsize.discrete.height == m_height) + m_frameSize->setCurrentIndex(frmsize.index); + } while (!enum_framesizes(frmsize)); + } m_discreteSizes = true; m_frameWidth->setEnabled(false); @@ -2187,7 +2190,8 @@ void GeneralTab::updateFrameSize() m_frameHeight->setMaximum(m_height); m_frameHeight->setValue(m_height); m_frameHeight->blockSignals(false); - m_frameSize->setEnabled(!m_haveBuffers); + if (m_frameSize) + m_frameSize->setEnabled(!m_haveBuffers); updateFrameInterval(); return; } -- 2.43.0