[-] Fixed crash in Fluidsynth when no soundfont is loaded

This commit is contained in:
cybermind 2015-02-14 23:28:44 +05:00
parent 84f9fc0f7b
commit 28c49d7370

View file

@ -169,7 +169,7 @@ void CleanFluidSynth(bool reinit)
delete_fluid_player(FluidSynthesizer.Player);
FluidSynthesizer.Player = new_fluid_player(FluidSynthesizer.Synth);
FluidSynthesizer.State = StateInitialized;
} else {
} else if (FluidSynthesizer.State != StateCleaned) {
if (FluidSynthesizer.Player) {
delete_fluid_player(FluidSynthesizer.Player);
}
@ -193,6 +193,7 @@ int InitFluidSynth()
if (FluidSynthesizer.State > StateCleaned) {
return 0;
}
FluidSynthesizer.State = StateInitialized;
// Settings
FluidSynthesizer.Settings = new_fluid_settings();
if (FluidSynthesizer.Settings == NULL) {
@ -231,7 +232,6 @@ int InitFluidSynth()
CleanFluidSynth();
return -1;
}
FluidSynthesizer.State = StateInitialized;
return 0;
}