hyprctl: nullptr guard --systeminfo (#11822)

running Hyprland --systeminfo from a console/tty calls systemInfoRequest
without us having a g_pCompositor or g_pHyprOpengl, so just if check them
and make --systeminfo not segfault and atleast print what info we can.
This commit is contained in:
Tom Englund 2025-09-25 01:44:07 +02:00 committed by GitHub
parent ec9a72d9fb
commit 683fc77f80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1180,8 +1180,12 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
} else } else
result += "\tunknown: not runtime\n"; result += "\tunknown: not runtime\n";
if (g_pHyprOpenGL) {
result += std::format("\nExplicit sync: {}", g_pHyprOpenGL->m_exts.EGL_ANDROID_native_fence_sync_ext ? "supported" : "missing"); result += std::format("\nExplicit sync: {}", g_pHyprOpenGL->m_exts.EGL_ANDROID_native_fence_sync_ext ? "supported" : "missing");
result += std::format("\nGL ver: {}", g_pHyprOpenGL->m_eglContextVersion == CHyprOpenGLImpl::EGL_CONTEXT_GLES_3_2 ? "3.2" : "3.0"); result += std::format("\nGL ver: {}", g_pHyprOpenGL->m_eglContextVersion == CHyprOpenGLImpl::EGL_CONTEXT_GLES_3_2 ? "3.2" : "3.0");
}
if (g_pCompositor) {
result += std::format("\nBackend: {}", g_pCompositor->m_aqBackend->hasSession() ? "drm" : "sessionless"); result += std::format("\nBackend: {}", g_pCompositor->m_aqBackend->hasSession() ? "drm" : "sessionless");
result += "\n\nMonitor info:"; result += "\n\nMonitor info:";
@ -1194,6 +1198,7 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
check(m->m_output->parsedEDID.chromaticityCoords.has_value()), check(m->m_output->parsedEDID.supportsBT2020), check(m->m_output->vrrCapable), check(m->m_output->parsedEDID.chromaticityCoords.has_value()), check(m->m_output->parsedEDID.supportsBT2020), check(m->m_output->vrrCapable),
check(m->m_output->nonDesktop)); check(m->m_output->nonDesktop));
} }
}
if (g_pHyprCtl && g_pHyprCtl->m_currentRequestParams.sysInfoConfig) { if (g_pHyprCtl && g_pHyprCtl->m_currentRequestParams.sysInfoConfig) {
result += "\n======Config-Start======\n"; result += "\n======Config-Start======\n";