Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
digao-dalpiaz committed Jun 8, 2023
1 parent 4e1792e commit e6fa166
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions DigaoDeskApp/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,16 @@ public static List<Process> GetChildProcesses(Process parent)
foreach (ManagementObject mo in processList)
{
var pid = Convert.ToInt32(mo.GetPropertyValue("ProcessId"));
Process proc = null;
Process proc;
try
{
proc = Process.GetProcessById(pid);
}
catch (ArgumentException) { } //PID already expired

if (proc != null) ret.Add(proc);
catch (ArgumentException)
{
continue; //PID already expired
}
ret.Add(proc);
}
return ret;
}
Expand Down

0 comments on commit e6fa166

Please sign in to comment.