aboutsummaryrefslogtreecommitdiff
path: root/src/input_common
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-06-14 20:48:24 +0200
committercrueter <crueter@eden-emu.dev>2026-06-14 20:48:24 +0200
commit60e10327715e420f652ed148e72e22ce8ded55a3 (patch)
tree8ab3722ac19e31d61e85e7134ebfe4232b1bc540 /src/input_common
parent10713532917591445080bee19159447b683b548a (diff)
[qt] fix various crashes due to invalid/corrupted/outdated settings (#4070)
lots of "out of index" errors :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4070 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'src/input_common')
-rw-r--r--src/input_common/drivers/udp_client.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp
index fc216e3c9f..7566e6040c 100644
--- a/src/input_common/drivers/udp_client.cpp
+++ b/src/input_common/drivers/udp_client.cpp
@@ -31,8 +31,10 @@ public:
using clock = std::chrono::system_clock;
explicit Socket(const std::string& host, u16 port, SocketCallback callback_)
- : callback(std::move(callback_)), timer(io_context),
- socket(io_context, udp::endpoint(udp::v4(), 0)), client_id(Common::Random::Random32(0)) {
+ : callback(std::move(callback_)), timer(io_context)
+ , socket(io_context, udp::endpoint(udp::v4(), 0))
+ , client_id(Common::Random::Random32(0))
+ {
boost::system::error_code ec{};
auto ipv4 = boost::asio::ip::make_address_v4(host, ec);
if (ec.value() != boost::system::errc::success) {
@@ -353,8 +355,13 @@ PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const {
}
Common::UUID UDPClient::GetHostUUID(const std::string& host) const {
- const auto ip = boost::asio::ip::make_address_v4(host);
- const auto hex_host = fmt::format("00000000-0000-0000-0000-0000{:06x}", ip.to_uint());
+ boost::system::error_code ec{};
+ auto ip = boost::asio::ip::make_address_v4(host, ec);
+ if (ec.value() != boost::system::errc::success) {
+ LOG_ERROR(Input, "Invalid IPv4 address \"{}\" provided", host);
+ ip = boost::asio::ip::address_v4{};
+ }
+ auto const hex_host = fmt::format("00000000-0000-0000-0000-0000{:06x}", ip.to_uint());
return Common::UUID{hex_host};
}