File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -687,9 +687,18 @@ bool CVideoModeManager::GetCurrentAdapterRect(LPRECT pOutRect)
687687// /////////////////////////////////////////////////////////////
688688SString CVideoModeManager::GetCurrentAdapterDeviceName ()
689689{
690- MONITORINFOEX monitorInfo;
690+ if (!m_hCurrentMonitor)
691+ return " " ;
692+
693+ MONITORINFOEX monitorInfo{};
691694 monitorInfo.cbSize = sizeof (MONITORINFOEX);
692- if (GetMonitorInfo (m_hCurrentMonitor, &monitorInfo))
693- return monitorInfo.szDevice ;
695+
696+ if (GetMonitorInfoA (m_hCurrentMonitor, &monitorInfo))
697+ {
698+ // Ensure null termination for x86 safety
699+ monitorInfo.szDevice [sizeof (monitorInfo.szDevice ) - 1 ] = ' \0 ' ;
700+ return SString (monitorInfo.szDevice );
701+ }
702+
694703 return " " ;
695704}
You can’t perform that action at this time.
0 commit comments