From d72bf7ecbbbb13a42e1a2ea94cd77aaec8ec5d5a Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Mon, 17 Dec 2012 01:07:24 -0800 Subject: [PATCH] Fix an SMO crash when a song is using non-roman song titles. Taken from OITG, it's definitely not the _right_ fix, but it'll do the job. --- src/Font.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Font.cpp b/src/Font.cpp index f4df3b1658..d6c72911a6 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -285,7 +285,16 @@ void Font::MergeFont(Font &f) const glyph &Font::GetGlyph( wchar_t c ) const { - ASSERT(c >= 0 && c <= 0xFFFFFF); + /* XXX: This is kind of nasty, but the parts that touch this are dark and + * scary. --Colby + * + * Snagged from OpenITG, original comment: + * shooting a blank really...DarkLink kept running into the stupid assert + * with non-roman song titles, and looking at it, I'm gonna guess that + * this is how ITG2 prevented crashing with them --infamouspat */ + //ASSERT(c >= 0 && c <= 0xFFFFFF); + if (c < 0 || c > 0xFFFFFF) + c = 1; // Fast path: if( c < (int) ARRAYLEN(m_iCharToGlyphCache) && m_iCharToGlyphCache[c] )