Merge pull request #1923 from eliask/fix-lrc-parsing-crash
Fix LRC parsing crash for unrecognized values
This commit is contained in:
@@ -90,10 +90,11 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
|
|||||||
// offsets each timestamp after the offset by that amount.
|
// offsets each timestamp after the offset by that amount.
|
||||||
//float fLyricOffset = 0.0f;
|
//float fLyricOffset = 0.0f;
|
||||||
|
|
||||||
|
// Enforce strict timestamp format to prevent crashing the program.
|
||||||
|
vector<RString> dummy;
|
||||||
|
static Regex timestamp("^([0-9]+:){0,2}[0-9]+(.[0-9]*)?$");
|
||||||
|
if (timestamp.Compare(sValueName, dummy))
|
||||||
{
|
{
|
||||||
/* If we've gotten this far, and no other statement caught this
|
|
||||||
* value before this does, assume it's a time value. */
|
|
||||||
|
|
||||||
LyricSegment seg;
|
LyricSegment seg;
|
||||||
seg.m_Color = CurrentColor;
|
seg.m_Color = CurrentColor;
|
||||||
seg.m_fStartTime = HHMMSSToSeconds(sValueName);
|
seg.m_fStartTime = HHMMSSToSeconds(sValueName);
|
||||||
|
|||||||
Reference in New Issue
Block a user