output: avoid crashing on no crtc

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:03:25 +02:00
parent 696a5ad4ec
commit 8fc0c549b7
1 changed files with 4 additions and 0 deletions

View File

@ -1713,6 +1713,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;
}