aboutsummaryrefslogtreecommitdiff
path: root/src/core/network/network_interface.cpp
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-08-21 10:27:36 -0400
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-08-27 02:10:58 -0400
commit2d685e5a5111f97813dc09e2b491973b73b28932 (patch)
tree7c1ab8ee811ae32c08dfb438c07667516d5a6420 /src/core/network/network_interface.cpp
parent4ef01eb41ed60e4d4f2fc7b7e2e19f031610d416 (diff)
network_interface: Replace default return value with std::nullopt
Diffstat (limited to 'src/core/network/network_interface.cpp')
-rw-r--r--src/core/network/network_interface.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/network/network_interface.cpp b/src/core/network/network_interface.cpp
index cecc9aa115..a8f41c6bc8 100644
--- a/src/core/network/network_interface.cpp
+++ b/src/core/network/network_interface.cpp
@@ -180,11 +180,11 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
#endif
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();
if (network_interfaces.size() == 0) {
LOG_ERROR(Network, "GetAvailableNetworkInterfaces returned no interfaces");
- return {};
+ return std::nullopt;
}
const auto res =
@@ -192,12 +192,12 @@ std::optional<NetworkInterface> GetSelectedNetworkInterface() {
return iface.name == selected_network_interface;
});
- if (res != network_interfaces.end()) {
- return *res;
- } else {
+ if (res == network_interfaces.end()) {
LOG_ERROR(Network, "Couldn't find selected interface \"{}\"", selected_network_interface);
- return {};
+ return std::nullopt;
}
+
+ return *res;
}
} // namespace Network