return NULL if LADSPA alloc fails

instead of assertion fail
This commit is contained in:
Tom M 2017-10-04 19:59:31 +02:00 committed by GitHub
parent 5ac826d0e0
commit 10c4cfa29e

View file

@ -40,9 +40,13 @@
#define L(x); #define L(x);
fluid_LADSPA_FxUnit_t* new_fluid_LADSPA_FxUnit(fluid_synth_t* synth){ fluid_LADSPA_FxUnit_t* new_fluid_LADSPA_FxUnit(fluid_synth_t* synth){
if(synth == NULL)
return NULL;
fluid_LADSPA_FxUnit_t* FxUnit=FLUID_NEW(fluid_LADSPA_FxUnit_t); fluid_LADSPA_FxUnit_t* FxUnit=FLUID_NEW(fluid_LADSPA_FxUnit_t);
assert(FxUnit); if(FxUnit == NULL)
assert(synth); return NULL;
/* The default state is 'bypassed'. The Fx unit has to be turned on explicitly by the user. */ /* The default state is 'bypassed'. The Fx unit has to be turned on explicitly by the user. */
/* Those settings have to be done in order to allow fluid_LADSPA_clean. */ /* Those settings have to be done in order to allow fluid_LADSPA_clean. */
FxUnit->Bypass=fluid_LADSPA_Bypassed; FxUnit->Bypass=fluid_LADSPA_Bypassed;