fix CourseID::ToCourse for autogen courses
This commit is contained in:
@@ -200,12 +200,21 @@ void CourseID::FromCourse( const Course *p )
|
|||||||
|
|
||||||
Course *CourseID::ToCourse() const
|
Course *CourseID::ToCourse() const
|
||||||
{
|
{
|
||||||
Course* pCourse = NULL;
|
if( !sPath.empty() )
|
||||||
pCourse = SONGMAN->GetCourseFromPath( sPath );
|
{
|
||||||
if( pCourse )
|
Course *pCourse = SONGMAN->GetCourseFromPath( sPath );
|
||||||
return pCourse;
|
if( pCourse )
|
||||||
pCourse = SONGMAN->GetCourseFromName( sFullTitle );
|
return pCourse;
|
||||||
return pCourse;
|
}
|
||||||
|
|
||||||
|
if( !sFullTitle.empty() )
|
||||||
|
{
|
||||||
|
Course *pCourse = SONGMAN->GetCourseFromName( sFullTitle );
|
||||||
|
if( pCourse )
|
||||||
|
return pCourse;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
XNode* CourseID::CreateNode() const
|
XNode* CourseID::CreateNode() const
|
||||||
|
|||||||
@@ -968,6 +968,9 @@ Song* SongManager::GetSongFromDir( CString sDir )
|
|||||||
|
|
||||||
Course* SongManager::GetCourseFromPath( CString sPath )
|
Course* SongManager::GetCourseFromPath( CString sPath )
|
||||||
{
|
{
|
||||||
|
if( sPath == "" )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for( unsigned int i=0; i<m_pCourses.size(); i++ )
|
for( unsigned int i=0; i<m_pCourses.size(); i++ )
|
||||||
if( sPath.CompareNoCase(m_pCourses[i]->m_sPath) == 0 )
|
if( sPath.CompareNoCase(m_pCourses[i]->m_sPath) == 0 )
|
||||||
return m_pCourses[i];
|
return m_pCourses[i];
|
||||||
@@ -977,6 +980,9 @@ Course* SongManager::GetCourseFromPath( CString sPath )
|
|||||||
|
|
||||||
Course* SongManager::GetCourseFromName( CString sName )
|
Course* SongManager::GetCourseFromName( CString sName )
|
||||||
{
|
{
|
||||||
|
if( sName == "" )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for( unsigned int i=0; i<m_pCourses.size(); i++ )
|
for( unsigned int i=0; i<m_pCourses.size(); i++ )
|
||||||
if( sName.CompareNoCase(m_pCourses[i]->GetFullDisplayTitle()) == 0 )
|
if( sName.CompareNoCase(m_pCourses[i]->GetFullDisplayTitle()) == 0 )
|
||||||
return m_pCourses[i];
|
return m_pCourses[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user