diff --git a/SteamKit2/SteamKit2/Util/HardwareUtils.cs b/SteamKit2/SteamKit2/Util/HardwareUtils.cs index 58aeaf782..4b851b9c4 100644 --- a/SteamKit2/SteamKit2/Util/HardwareUtils.cs +++ b/SteamKit2/SteamKit2/Util/HardwareUtils.cs @@ -56,17 +56,23 @@ public override byte[] GetMacAddress() // mono seems to have a pretty solid implementation of NetworkInterface for our platforms // if it turns out to be buggy we can always roll our own and poke into /sys/class/net on nix - var firstEth = NetworkInterface.GetAllNetworkInterfaces() - .Where( i => i.NetworkInterfaceType == NetworkInterfaceType.Ethernet || i.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ) - .FirstOrDefault(); + try + { + var firstEth = NetworkInterface.GetAllNetworkInterfaces() + .Where( i => i.NetworkInterfaceType == NetworkInterfaceType.Ethernet || i.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ) + .FirstOrDefault(); - if ( firstEth == null ) + if ( firstEth != null ) + { + return firstEth.GetPhysicalAddress().GetAddressBytes(); + } + } + catch ( NetworkInformationException ) { - // well... - return Encoding.UTF8.GetBytes( "SteamKit-MacAddress" ); + // See: https://github.com/SteamRE/SteamKit/issues/629 } - - return firstEth.GetPhysicalAddress().GetAddressBytes(); + // well... + return Encoding.UTF8.GetBytes( "SteamKit-MacAddress" ); } public override byte[] GetDiskId()