summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2026-03-01 00:07:08 -0600
committerTellowKrinkle <tellowkrinkle@gmail.com>2026-03-01 00:08:08 -0600
commit80762e0575aded7f43addcaab7eb4847589d31db (patch)
tree56b1a897fd8728a856299e223c8ea2fab2087521 /Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
parent63fc9d7ca34285cf9217a62abc0156f7ffbc6e80 (diff)
DSU: Don't crash on bad hostname
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
index 2247dabbda..dad0844beb 100644
--- a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
@@ -260,11 +260,18 @@ void InputBackend::HotplugThreadFunc()
list_ports.pad_request_count = SERVER_ASKED_PADS;
list_ports.pad_ids = {0, 1, 2, 3};
msg.Finish();
- if (server.m_socket.send(&list_ports, sizeof list_ports,
- sf::IpAddress::resolve(server.m_address).value(),
- server.m_port) != sf::Socket::Status::Done)
+ if (std::optional<sf::IpAddress> server_ip = sf::IpAddress::resolve(server.m_address))
{
- ERROR_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient HotplugThreadFunc send failed");
+ if (server.m_socket.send(&list_ports, sizeof list_ports, *server_ip, server.m_port) !=
+ sf::Socket::Status::Done)
+ {
+ ERROR_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient HotplugThreadFunc send failed");
+ }
+ }
+ else
+ {
+ ERROR_LOG_FMT(CONTROLLERINTERFACE, "DualShockUDPClient failed to resolve {}",
+ server.m_address);
}
timed_out_servers[i] = true;
}