Skip to content

Commit fa916d8

Browse files
deaquinoBornToBeRoot
authored andcommitted
NullReferenceException fixed (#86)
ConfigGateway set error FirstOrDefault with empty collections.
1 parent 41499cc commit fa916d8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Source/NETworkManager/ViewModels/NetworkInterfaceViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public NetworkInterfaceInfo SelectedNetworkInterface
159159
ConfigEnableStaticIPAddress = true;
160160
ConfigIPAddress = (value != null) ? value.IPv4Address.FirstOrDefault().ToString() : string.Empty;
161161
ConfigSubnetmaskOrCidr = (value.Subnetmask != null) ? value.Subnetmask.FirstOrDefault().ToString() : string.Empty;
162-
ConfigGateway = (value.IPv4Gateway != null) ? value.IPv4Gateway.FirstOrDefault().ToString() : string.Empty;
162+
ConfigGateway = (value.IPv4Gateway?.Any() == true) ? value.IPv4Gateway.FirstOrDefault().ToString() : string.Empty;
163163
}
164164

165165
if (value.DNSAutoconfigurationEnabled)

0 commit comments

Comments
 (0)