Fix error check. (#324)

In case when the interface is removed (File Not Found error), the value of
NativeErrorCode is 2, while the value of HResult is 0x80004005.

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
This commit is contained in:
Oldřich Jedlička
2020-11-04 18:13:47 +01:00
committed by GitHub
parent db339d5623
commit 17471285e3
@@ -98,7 +98,7 @@ namespace LibreHardwareMonitor.Hardware.Network
_bytesDownloaded = interfaceStats.BytesReceived;
_lastTick = newTick;
}
catch (NetworkInformationException networkInformationException) when (unchecked(networkInformationException.NativeErrorCode == (int)0x80004005))
catch (NetworkInformationException networkInformationException) when (unchecked(networkInformationException.HResult == (int)0x80004005))
{
foreach (NetworkInterface networkInterface in NetworkInterface.GetAllNetworkInterfaces())
{