output: avoid crashing on no crtc (#58)

dual gpus can init with no crtc and later rescan for them, however
getRenderFormats might be called before that happends and null ptr
deref, guard against it.
This commit is contained in:
Tom Englund 2024-08-20 21:10:13 +02:00 committed by GitHub
parent b474796cdb
commit b02d4f4d72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1718,6 +1718,10 @@ size_t Aquamarine::CDRMOutput::getGammaSize() {
}
std::vector<SDRMFormat> Aquamarine::CDRMOutput::getRenderFormats() {
if (!connector->crtc || !connector->crtc->primary || connector->crtc->primary->formats.empty()) {
backend->log(AQ_LOG_ERROR, "Can't get formats: no crtc");
return {};
}
return connector->crtc->primary->formats;
}