diff --git a/stepmania/src/RageUtil_FileDB.cpp b/stepmania/src/RageUtil_FileDB.cpp index be3dcdee0f..df557999f1 100644 --- a/stepmania/src/RageUtil_FileDB.cpp +++ b/stepmania/src/RageUtil_FileDB.cpp @@ -296,11 +296,16 @@ File *FilenameDB::GetFile( const CString &sPath ) SplitPath(sPath, Dir, Name); FileSet &fs = GetFileSet( Dir ); - set::iterator i = fs.files.find( File(Name) ); - if(i == fs.files.end()) + set::iterator it; + it = fs.files.find( File(Name) ); + if( it == fs.files.end() ) return NULL; - return &*i; + /* Oops. &*it is a const File &, because you can't change the order + * of something once it's in a list. Cast away the const; we won't + * change the filename (used for the ordering), but the rest of the + * values are non-const. */ + return const_cast (&*it); }