Fix possible crash in discord rpc

This commit is contained in:
Benau 2021-10-30 10:04:17 +08:00
parent 1fd18c8d88
commit 1470eb3939

View File

@ -603,7 +603,12 @@ public:
// ----------------------------------------------------------------------------------------
core::stringw getDifficultyName(Difficulty diff) const;
// ----------------------------------------------------------------------------------------
const std::string& getTrackName() const { return m_tracks[m_track_number];}
const std::string getTrackName() const
{
if (m_tracks.empty())
return "";
return m_tracks[m_track_number];
}
// ----------------------------------------------------------------------------------------
const GrandPrixData& getGrandPrix() const { return m_grand_prix; }
// ----------------------------------------------------------------------------------------