Clean nullable warnings in traffic router

This commit is contained in:
MaxFan
2026-05-11 21:25:14 +03:30
parent a51bcbdadd
commit 247c59c563
3 changed files with 7 additions and 5 deletions
@@ -121,7 +121,7 @@ public partial class TrafficRouterService
for (int hop = 0; hop < 8 && current > 4; hop++)
{
var name = GetProcessNameByPid(current);
if (IsExecutableTargeted(name))
if (!string.IsNullOrWhiteSpace(name) && IsExecutableTargeted(name))
{
_pidTargetOwnerCache[pid] = name;
return name;
@@ -75,7 +75,7 @@ public partial class TrafficRouterService
if (TryParseConnectionTuple(buffer, readLen, out var tuple))
{
var processName = connectionCache.GetProcessName(tuple);
if (IsExecutableTargeted(processName))
if (!string.IsNullOrWhiteSpace(processName) && IsExecutableTargeted(processName))
{
shouldRedirect = true;
matchedProcess = processName;
@@ -99,7 +99,9 @@ public partial class TrafficRouterService
}
isBlockedProc = !_fullRouteEnabled && IsExecutableBlocked(packetProc);
if (!shouldRoute && !isBlockedProc && IsExecutableTargeted(packetProc))
if (!shouldRoute && !isBlockedProc &&
!string.IsNullOrWhiteSpace(packetProc) &&
IsExecutableTargeted(packetProc))
{
shouldRoute = true;
_ipToProcess[dstNbo] = packetProc;
@@ -202,7 +204,7 @@ public partial class TrafficRouterService
dnsProc = connCache.GetProcessName(tuple2);
}
if (IsExecutableTargeted(dnsProc))
if (!string.IsNullOrWhiteSpace(dnsProc) && IsExecutableTargeted(dnsProc))
{
uint publicDnsNbo = _dnsRedirectIpNbo;
@@ -275,7 +277,7 @@ public partial class TrafficRouterService
}
// Check if source app is in target tunnel apps
if (IsExecutableTargeted(procName))
if (!string.IsNullOrWhiteSpace(procName) && IsExecutableTargeted(procName))
{
shouldRoute = true;
}