fixed: don't render anything at all if a char can't be found, this also prevents allocating an extra element in the map

This commit is contained in:
Bob van Loosen 2012-12-20 17:02:33 +01:00
parent 4c368d2735
commit f175fa9b3c

View file

@ -366,7 +366,10 @@ void CBitVis::SetText(uint8_t* buff, const char* str, int offset /*= 0*/)
int pixlength = 0; int pixlength = 0;
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
vector<unsigned int>& dchar = m_glyphs[str[i]]; map<char, vector<unsigned int> >::iterator it = m_glyphs.find(str[i]);
vector<unsigned int>& dchar = it->second;
if (it != m_glyphs.end())
{
for (size_t j = 0; j < dchar.size(); j++) for (size_t j = 0; j < dchar.size(); j++)
{ {
if (charpos >= 0 && charpos < m_nrcolumns) if (charpos >= 0 && charpos < m_nrcolumns)
@ -387,6 +390,7 @@ void CBitVis::SetText(uint8_t* buff, const char* str, int offset /*= 0*/)
pixlength++; pixlength++;
} }
} }
}
if (pixlength > m_nrcolumns && GetTimeUs() - m_songupdatetime > 2000000) if (pixlength > m_nrcolumns && GetTimeUs() - m_songupdatetime > 2000000)
{ {