Skip to content

Commit

Permalink
Handle missing status data
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-r-elp committed Sep 1, 2024
1 parent 049c994 commit 9a8ce96
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/UI/MpPerPlayerUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,12 @@ namespace MultiplayerCore::UI {
auto locposition = _lobbyViewController->_startGameReadyButton->gameObject->transform->localPosition;
ppth->gameObject->transform->localPosition = locposition;

DEBUG("Enabling PP Difficulties: {} PP Modifiers: {}", _statusRepository->GetLastStatusData()->get_SupportsPPDifficulties(), _statusRepository->GetLastStatusData()->get_SupportsPPModifiers());
DEBUG("Enabling PP Difficulties: {} PP Modifiers: {}", _statusRepository->GetLastStatusData() ? _statusRepository->GetLastStatusData()->get_SupportsPPDifficulties() : false, _statusRepository->GetLastStatusData() ? _statusRepository->GetLastStatusData()->get_SupportsPPModifiers() : false);

ppth->gameObject->SetActive(Hooks::NetworkConfigHooks::IsOverridingAPI() && (_statusRepository->GetLastStatusData()->get_SupportsPPDifficulties() || _statusRepository->GetLastStatusData()->get_SupportsPPModifiers()));
ppdt->gameObject->SetActive(_statusRepository->GetLastStatusData()->get_SupportsPPDifficulties());
ppmt->gameObject->SetActive(_statusRepository->GetLastStatusData()->get_SupportsPPModifiers());
ppth->gameObject->SetActive(Hooks::NetworkConfigHooks::IsOverridingAPI() && _statusRepository->GetLastStatusData() && (_statusRepository->GetLastStatusData()->get_SupportsPPDifficulties() || _statusRepository->GetLastStatusData()->get_SupportsPPModifiers()));
ppdt->gameObject->SetActive(_statusRepository->GetLastStatusData() && _statusRepository->GetLastStatusData()->get_SupportsPPDifficulties());
ppmt->gameObject->SetActive(_statusRepository->GetLastStatusData() && _statusRepository->GetLastStatusData()->get_SupportsPPModifiers());
if (!_statusRepository->GetLastStatusData()) ERROR("Missing Status Data for current server status endpoint {} (Check your config)", Hooks::NetworkConfigHooks::GetCurrentServer() ? Hooks::NetworkConfigHooks::GetCurrentServer()->masterServerStatusUrl : "null");
}

void MpPerPlayerUI::ModifierSelectionDidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) {
Expand Down

0 comments on commit 9a8ce96

Please sign in to comment.