mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
network_interface: Replace default return value with std::nullopt
This commit is contained in:
parent
d10d480642
commit
a32a7dacf4
1 changed files with 6 additions and 6 deletions
|
@ -180,11 +180,11 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::optional<NetworkInterface> GetSelectedNetworkInterface() {
|
std::optional<NetworkInterface> GetSelectedNetworkInterface() {
|
||||||
const std::string& selected_network_interface = Settings::values.network_interface.GetValue();
|
const auto& selected_network_interface = Settings::values.network_interface.GetValue();
|
||||||
const auto network_interfaces = Network::GetAvailableNetworkInterfaces();
|
const auto network_interfaces = Network::GetAvailableNetworkInterfaces();
|
||||||
if (network_interfaces.size() == 0) {
|
if (network_interfaces.size() == 0) {
|
||||||
LOG_ERROR(Network, "GetAvailableNetworkInterfaces returned no interfaces");
|
LOG_ERROR(Network, "GetAvailableNetworkInterfaces returned no interfaces");
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto res =
|
const auto res =
|
||||||
|
@ -192,12 +192,12 @@ std::optional<NetworkInterface> GetSelectedNetworkInterface() {
|
||||||
return iface.name == selected_network_interface;
|
return iface.name == selected_network_interface;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res != network_interfaces.end()) {
|
if (res == network_interfaces.end()) {
|
||||||
return *res;
|
|
||||||
} else {
|
|
||||||
LOG_ERROR(Network, "Couldn't find selected interface \"{}\"", selected_network_interface);
|
LOG_ERROR(Network, "Couldn't find selected interface \"{}\"", selected_network_interface);
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return *res;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Network
|
} // namespace Network
|
||||||
|
|
Loading…
Reference in a new issue