Skip to content

Commit

Permalink
Minor correction for gcc complaining about signed-unsigned comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
123jimin committed Mar 21, 2021
1 parent 60f358e commit c5acb48
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Main/src/SettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,16 @@ class SettingsPage
void Load()
{
String str = g_gameConfig.GetString(m_key);
m_len = static_cast<int>(str.length());

if (m_len >= m_buffer.size())
if (str.length() >= m_buffer.size())
{
Logf("Config key=%d cropped due to being too long (%d)", Logger::Severity::Error, static_cast<int>(m_key), m_len);
m_len = static_cast<int>(m_buffer.size() - 1);
}
else
{
m_len = static_cast<int>(str.length());
}

std::memcpy(m_buffer.data(), str.data(), m_len + 1);
}
Expand Down

0 comments on commit c5acb48

Please sign in to comment.