prevent unloading of nothing

This commit is contained in:
Alex Birch 2018-03-05 22:38:51 +00:00
parent c78756aeef
commit 592dd264c0
No known key found for this signature in database
GPG Key ID: 305EB1F98D44ACBA

View File

@ -131,7 +131,10 @@ void FluidSynthModel::onFileNameChanged(const string &absPath) {
}
void FluidSynthModel::unloadAndLoadFont(const string &absPath) {
fluid_synth_sfunload(synth, sfont_id, 1);
// in the base case, there is no font loaded
if (fluid_synth_sfcount(synth) > 0) {
fluid_synth_sfunload(synth, sfont_id, 1);
}
loadFont(absPath);
}