From ed6c845a8cd2be6336eb3915b99a3fd34f381895 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:17:49 -0500 Subject: [PATCH] netplay: Tweak optional.hpp usage --- lib/netplay/netsocket.cpp | 2 +- lib/netplay/netsocket.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/netplay/netsocket.cpp b/lib/netplay/netsocket.cpp index b449acb9783..f03be08e7e1 100644 --- a/lib/netplay/netsocket.cpp +++ b/lib/netplay/netsocket.cpp @@ -72,7 +72,7 @@ struct Socket SOCKET fd[SOCK_COUNT]; bool ready; - nonstd::optional writeErrorCode; + optional writeErrorCode = nullopt; bool deleteLater; char textAddress[40] = {}; diff --git a/lib/netplay/netsocket.h b/lib/netplay/netsocket.h index a660a744645..01413011cd3 100644 --- a/lib/netplay/netsocket.h +++ b/lib/netplay/netsocket.h @@ -27,6 +27,8 @@ #include #include +using nonstd::optional; +using nonstd::nullopt; #include namespace net @@ -158,7 +160,7 @@ struct OpenConnectionResult void operator()(Socket* b) { if (b) { socketClose(b); } } }; std::unique_ptr open_socket; - nonstd::optional errorCode; + optional errorCode = nullopt; std::string errorString; }; typedef std::function OpenConnectionToHostResultCallback;