Fix crash when testing unsupported MIDI file
smf_delete() does not handle NULL, and segfaults instead. This only crashes with optimized builds. libsmf will call g_critical() earlier and in that case debug-builds call UI::handle_fatal() and ask the user to "click to exit".
This commit is contained in:
parent
518f8108ac
commit
dd5f124c60
@ -97,10 +97,11 @@ SMF::test(const std::string& path)
|
||||
smf_t* test_smf = smf_load(f);
|
||||
fclose(f);
|
||||
|
||||
const bool success = (test_smf != NULL);
|
||||
if (!test_smf) {
|
||||
return false;
|
||||
}
|
||||
smf_delete(test_smf);
|
||||
|
||||
return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Attempt to open the SMF file for reading and/or writing.
|
||||
|
Loading…
Reference in New Issue
Block a user