diff options
author | Sönke Holz <sholz8530@gmail.com> | 2021-08-13 00:37:03 +0200 |
---|---|---|
committer | Sönke Holz <sholz8530@gmail.com> | 2021-08-13 00:37:03 +0200 |
commit | 8513e594310af03df7613fb3255b6ca5cd84710d (patch) | |
tree | 083ff1ba9d82ab20a2a8ec6b28d04e77b82d1aa3 | |
parent | configuration: use tr instead of QStringLiteral for "None" item in (diff) | |
download | yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.tar yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.tar.gz yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.tar.bz2 yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.tar.lz yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.tar.xz yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.tar.zst yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.zip |
-rw-r--r-- | src/core/network/network_interface.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/network/network_interface.cpp b/src/core/network/network_interface.cpp index 887aee708..34e20f547 100644 --- a/src/core/network/network_interface.cpp +++ b/src/core/network/network_interface.cpp @@ -22,8 +22,6 @@ namespace Network { #ifdef _WIN32 std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { - std::vector<NetworkInterface> result; - std::vector<u8> adapter_addresses_raw; auto adapter_addresses = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_addresses_raw.data()); DWORD ret = ERROR_BUFFER_OVERFLOW; @@ -44,6 +42,8 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { } if (ret == NO_ERROR) { + std::vector<NetworkInterface> result; + for (auto current_address = adapter_addresses; current_address != nullptr; current_address = current_address->Next) { if (current_address->FirstUnicastAddress == nullptr || @@ -63,11 +63,12 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { .name{Common::UTF16ToUTF8(std::wstring{current_address->FriendlyName})}, .ip_address{ip_addr}}); } + + return result; } else { LOG_ERROR(Network, "Failed to get network interfaces with GetAdaptersAddresses"); + return {}; } - - return result; } #else |