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
This commit is contained in:
Xaver Hugl 2021-06-28 16:40:12 +02:00
parent ee4c9cd6d5
commit 2ecce63d93

View file

@ -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({