summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Morph2021-08-21 10:27:36 -0400
committerGravatar Morph2021-08-27 02:10:58 -0400
commita32a7dacf459e0730e7c1587c99d60c411c5f8b3 (patch)
tree7c1ab8ee811ae32c08dfb438c07667516d5a6420 /src
parentMerge pull request #6870 from yzct12345/trace-back-stack-back-stack-back (diff)
downloadyuzu-a32a7dacf459e0730e7c1587c99d60c411c5f8b3.tar.gz
yuzu-a32a7dacf459e0730e7c1587c99d60c411c5f8b3.tar.xz
yuzu-a32a7dacf459e0730e7c1587c99d60c411c5f8b3.zip
network_interface: Replace default return value with std::nullopt
Diffstat (limited to '')
-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 cecc9aa11..a8f41c6bc 100644
--- a/src/core/network/network_interface.cpp
+++ b/src/core/network/network_interface.cpp
@@ -180,11 +180,11 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
180#endif 180#endif
181 181
182std::optional<NetworkInterface> GetSelectedNetworkInterface() { 182std::optional<NetworkInterface> GetSelectedNetworkInterface() {
183 const std::string& selected_network_interface = Settings::values.network_interface.GetValue(); 183 const auto& selected_network_interface = Settings::values.network_interface.GetValue();
184 const auto network_interfaces = Network::GetAvailableNetworkInterfaces(); 184 const auto network_interfaces = Network::GetAvailableNetworkInterfaces();
185 if (network_interfaces.size() == 0) { 185 if (network_interfaces.size() == 0) {
186 LOG_ERROR(Network, "GetAvailableNetworkInterfaces returned no interfaces"); 186 LOG_ERROR(Network, "GetAvailableNetworkInterfaces returned no interfaces");
187 return {}; 187 return std::nullopt;
188 } 188 }
189 189
190 const auto res = 190 const auto res =
@@ -192,12 +192,12 @@ std::optional<NetworkInterface> GetSelectedNetworkInterface() {
192 return iface.name == selected_network_interface; 192 return iface.name == selected_network_interface;
193 }); 193 });
194 194
195 if (res != network_interfaces.end()) { 195 if (res == network_interfaces.end()) {
196 return *res;
197 } else {
198 LOG_ERROR(Network, "Couldn't find selected interface \"{}\"", selected_network_interface); 196 LOG_ERROR(Network, "Couldn't find selected interface \"{}\"", selected_network_interface);
199 return {}; 197 return std::nullopt;
200 } 198 }
199
200 return *res;
201} 201}
202 202
203} // namespace Network 203} // namespace Network