Catched exception while getting active desktop name

This commit is contained in:
Xinyu Hou 2014-11-20 13:44:35 +00:00
parent 5833b434ef
commit e71e7e1cd3
1 changed files with 13 additions and 9 deletions

View File

@ -176,7 +176,7 @@ String
MSWindowsSession::getActiveDesktopName() MSWindowsSession::getActiveDesktopName()
{ {
String result; String result;
try {
HDESK hd = OpenInputDesktop(0, TRUE, GENERIC_READ); HDESK hd = OpenInputDesktop(0, TRUE, GENERIC_READ);
if (hd != NULL) { if (hd != NULL) {
DWORD size; DWORD size;
@ -186,6 +186,10 @@ MSWindowsSession::getActiveDesktopName()
result = name; result = name;
CloseDesktop(hd); CloseDesktop(hd);
} }
}
catch (std::exception error) {
LOG((CLOG_ERR "failed to get active desktop name: %s", error.what()));
}
return result; return result;
} }