From c5f50ddb3261cca857f220440313df80010291bd Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Sat, 7 Aug 2021 02:11:40 -0400 Subject: [PATCH] Properly handle leaderboard name being NULL (#167) --- dll/steam_user_stats.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dll/steam_user_stats.h b/dll/steam_user_stats.h index 8d22cb7..5126af3 100644 --- a/dll/steam_user_stats.h +++ b/dll/steam_user_stats.h @@ -591,6 +591,12 @@ SteamAPICall_t FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderb { PRINT_DEBUG("FindOrCreateLeaderboard %s\n", pchLeaderboardName); std::lock_guard lock(global_mutex); + if (!pchLeaderboardName) { + LeaderboardFindResult_t data; + data.m_hSteamLeaderboard = 0; + data.m_bLeaderboardFound = 0; + return callback_results->addCallResult(data.k_iCallback, &data, sizeof(data)); + } unsigned int leader = find_leaderboard(pchLeaderboardName); if (!leader) { @@ -616,6 +622,12 @@ SteamAPICall_t FindLeaderboard( const char *pchLeaderboardName ) { PRINT_DEBUG("FindLeaderboard %s\n", pchLeaderboardName); std::lock_guard lock(global_mutex); + if (!pchLeaderboardName) { + LeaderboardFindResult_t data; + data.m_hSteamLeaderboard = 0; + data.m_bLeaderboardFound = 0; + return callback_results->addCallResult(data.k_iCallback, &data, sizeof(data)); + } auto settings_Leaderboards = settings->getLeaderboards(); if (settings_Leaderboards.count(pchLeaderboardName)) {