diff --git a/sunshine/platform/windows.cpp b/sunshine/platform/windows.cpp index 4192f9b8..d4cfe94c 100755 --- a/sunshine/platform/windows.cpp +++ b/sunshine/platform/windows.cpp @@ -42,7 +42,7 @@ public: ~vigem_t() { if(client) { - if(vigem_target_is_attached(x360.get())) { + if(x360 && vigem_target_is_attached(x360.get())) { auto status = vigem_target_remove(client.get(), x360.get()); if(!VIGEM_SUCCESS(status)) { BOOST_LOG(warning) << "Couldn't detach gamepad from ViGEm ["sv << util::hex(status).to_string_view() << ']'; diff --git a/sunshine/stream.cpp b/sunshine/stream.cpp index d67cefd8..0f5bce43 100644 --- a/sunshine/stream.cpp +++ b/sunshine/stream.cpp @@ -93,7 +93,9 @@ struct audio_packet_raw_t { #pragma pack(pop) safe::event_t launch_event; -auto input = std::make_shared(); + +//FIXME: This smells bad +std::shared_ptr input; struct config_t { audio::config_t audio; @@ -1016,6 +1018,7 @@ void cmd_play(host_t &host, peer_t peer, msg_t &&req) { } void rtpThread() { + input = std::make_shared(); rtsp_server_t server(RTSP_SETUP_PORT); server.map("OPTIONS"sv, &cmd_option);