Still unknown as to why, but the call to `nc->GetProperties()` can fail
when setting a friendly name on the Windows virtual ethernet adapter.
Ensure that `ncp` is not null before continuing and accessing the device
GUID.
This commit is contained in:
Grant Limberg 2023-03-01 18:00:59 -08:00 committed by GitHub
parent 936dda4773
commit 6cf3b65953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -850,6 +850,7 @@ void WindowsEthernetTap::setFriendlyName(const char *dn)
NETCON_PROPERTIES *ncp = nullptr; NETCON_PROPERTIES *ncp = nullptr;
nc->GetProperties(&ncp); nc->GetProperties(&ncp);
if (ncp != nullptr) {
GUID curId = ncp->guidId; GUID curId = ncp->guidId;
if (curId == _deviceGuid) { if (curId == _deviceGuid) {
wchar_t wtext[255]; wchar_t wtext[255];
@ -857,6 +858,7 @@ void WindowsEthernetTap::setFriendlyName(const char *dn)
nc->Rename(wtext); nc->Rename(wtext);
found = true; found = true;
} }
}
nc->Release(); nc->Release();
} }
} }