fixed the overlay crash when an invitation is sent (on guest side)

(cherry picked from commit fc4fbb33b11e03946bb158c465ce3cb8e02b3f45)
This commit is contained in:
otavepto 2024-01-06 07:43:34 +02:00
parent a453bca12e
commit f8bb8b2285

View File

@ -499,9 +499,13 @@ void Steam_Overlay::AddInviteNotification(std::pair<const Friend, friend_window_
notif.type = notification_type_invite; notif.type = notification_type_invite;
notif.frd = &wnd_state; notif.frd = &wnd_state;
char tmp[TRANSLATION_BUFFER_SIZE]; {
snprintf(tmp, sizeof(tmp), translationInvitedYouToJoinTheGame[current_language], wnd_state.first.name(), wnd_state.first.id()); char tmp[TRANSLATION_BUFFER_SIZE]{};
notif.message = tmp; auto first_friend = wnd_state.first;
auto name = first_friend.name();
snprintf(tmp, sizeof(tmp), translationInvitedYouToJoinTheGame[current_language], name.c_str(), (int32_t)first_friend.id());
notif.message = tmp;
}
notif.start_time = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()); notif.start_time = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch());
notifications.emplace_back(notif); notifications.emplace_back(notif);
@ -954,7 +958,7 @@ void Steam_Overlay::OverlayProc()
bool show = true; bool show = true;
char tmp[TRANSLATION_BUFFER_SIZE]; char tmp[TRANSLATION_BUFFER_SIZE]{};
snprintf(tmp, sizeof(tmp), translationRenderer[current_language], (_renderer == nullptr ? "Unknown" : _renderer->GetLibraryName().c_str())); snprintf(tmp, sizeof(tmp), translationRenderer[current_language], (_renderer == nullptr ? "Unknown" : _renderer->GetLibraryName().c_str()));
std::string windowTitle; std::string windowTitle;
windowTitle.append(translationSteamOverlay[current_language]); windowTitle.append(translationSteamOverlay[current_language]);