summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2020-10-15 20:58:18 -0700
committerGravatar bunnei2020-10-16 21:16:56 -0700
commit363c644730198338140d9611b575ff22e14e1287 (patch)
treeaf9da56c8c61f3f46a46de29cde4294f09bc2c71 /src
parentMerge pull request #4790 from lioncash/input-common (diff)
downloadyuzu-363c644730198338140d9611b575ff22e14e1287.tar.gz
yuzu-363c644730198338140d9611b575ff22e14e1287.tar.xz
yuzu-363c644730198338140d9611b575ff22e14e1287.zip
service: bcat: Check client connection before interacting with socket.
- Fixes a crash when BCAT service is offline.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/bcat/backend/boxcat.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp
index 589e288df..3b6f7498e 100644
--- a/src/core/hle/service/bcat/backend/boxcat.cpp
+++ b/src/core/hle/service/bcat/backend/boxcat.cpp
@@ -454,6 +454,16 @@ Boxcat::StatusResult Boxcat::GetStatus(std::optional<std::string>& global,
454 {std::string("Boxcat-Client-Type"), std::string(BOXCAT_CLIENT_TYPE)}, 454 {std::string("Boxcat-Client-Type"), std::string(BOXCAT_CLIENT_TYPE)},
455 }; 455 };
456 456
457 if (!client.is_valid()) {
458 LOG_ERROR(Service_BCAT, "Client is invalid, going offline!");
459 return StatusResult::Offline;
460 }
461
462 if (!client.is_socket_open()) {
463 LOG_ERROR(Service_BCAT, "Failed to open socket, going offline!");
464 return StatusResult::Offline;
465 }
466
457 const auto response = client.Get(BOXCAT_PATHNAME_EVENTS, headers); 467 const auto response = client.Get(BOXCAT_PATHNAME_EVENTS, headers);
458 if (response == nullptr) 468 if (response == nullptr)
459 return StatusResult::Offline; 469 return StatusResult::Offline;