Commit 03dc0681 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

platforms/drm: don't crash if drmModeGetConnector fails

I don't think this is the cause of 439208, where it's likely only a
side effect of some other issue; should be guarded against anyways.

CCBUG: 439208


(cherry picked from commit 2ecce63d)
parent 0b41f6ae
......@@ -22,8 +22,12 @@ DrmConnector::DrmConnector(DrmGpu *gpu, uint32_t connectorId)
: DrmObject(gpu, connectorId)
, m_conn(drmModeGetConnector(gpu->fd(), connectorId))
{
for (int i = 0; i < m_conn->count_encoders; ++i) {
m_encoders << m_conn->encoders[i];
if (m_conn) {
for (int i = 0; i < m_conn->count_encoders; ++i) {
m_encoders << m_conn->encoders[i];
}
} else {
qCWarning(KWIN_DRM) << "drmModeGetConnector failed!" << strerror(errno);
}
}
......@@ -31,6 +35,9 @@ DrmConnector::~DrmConnector() = default;
bool DrmConnector::init()
{
if (!m_conn || !m_conn->count_modes) {
return false;
}
qCDebug(KWIN_DRM) << "Creating connector" << id();
if (!initProps({
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment