Skip to content

Commit

Permalink
Filesystem : fix string indexes usage in file_is_partof_drumkit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyz committed Aug 27, 2018
1 parent a38a75d commit 27d1ac1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/core/src/helpers/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,21 +534,19 @@ bool Filesystem::file_is_partof_drumkit( const QString& fname )
if( fname.startsWith( usr_drumkits_dir() ) )
{
int start = usr_drumkits_dir().size();
int index = fname.indexOf( "/", start + 1 );
QString dkname = fname.midRef( start + 1, index - start - 1 ).toString();
if(drumkit_exists(dkname))
return true;
int index = fname.indexOf( "/", start );
QString dk_name = fname.midRef( start , index - start).toString();
return usr_drumkit_list().contains( dk_name );
}


if( fname.startsWith( sys_drumkits_dir() ) )
{
int start = sys_drumkits_dir().size();
int index = fname.indexOf( "/", start + 1 );
QString dkname = fname.midRef( start + 1, index - start - 1 ).toString();
if(drumkit_exists(dkname))
return true;
int index = fname.indexOf( "/", start);
QString dk_name = fname.midRef( start, index - start).toString();
return sys_drumkit_list().contains( dk_name );
}

return false;
}

Expand Down

0 comments on commit 27d1ac1

Please sign in to comment.