refact: return early in identifyWindowByPidEnv

-
This commit is contained in:
black-desk 2023-04-17 15:45:15 +08:00 committed by deepin-bot[bot]
parent 010d0c40f6
commit 4e43ef0cdb

View File

@ -223,7 +223,11 @@ AppInfo *WindowIdentify::identifyWindowByPidEnv(Dock *_dock, WindowInfoX *winInf
int pid = winInfo->getPid();
auto process = winInfo->getProcess();
qInfo() << "identifyWindowByPidEnv: pid=" << pid << " WindowId=" << winInfo->getXid();
if (pid != 0 && process) {
if (pid == 0 || !process) {
return ret;
}
QString launchedDesktopFile = process->getEnv("GIO_LAUNCHED_DESKTOP_FILE").c_str();
QString launchedDesktopFilePidStr = process->getEnv("GIO_LAUNCHED_DESKTOP_FILE_PID").c_str();
int launchedDesktopFilePid = launchedDesktopFilePidStr.toInt();
@ -255,7 +259,6 @@ AppInfo *WindowIdentify::identifyWindowByPidEnv(Dock *_dock, WindowInfoX *winInf
ret = new AppInfo(launchedDesktopFile);
innerId = ret->getInnerId();
}
}
return ret;
}