Merge pull request #1984 from michaelgregorius/1981-midicrash

Might fix 1981 ("Midi Import crash in master branch")
This commit is contained in:
Tres Finocchiaro
2015-04-24 18:49:26 +00:00

View File

@@ -374,20 +374,28 @@ bool MidiImport::readSMF( TrackContainer* tc )
if( evt->chan == -1 )
{
bool handled = false;
if( evt->is_update() )
if( evt->is_update() )
{
QString attr = evt->get_attribute();
if( attr == "tracknames" ) {
if( attr == "tracknames" && evt->get_update_type() == 'a' ) {
trackName = evt->get_atom_value();
handled = true;
}
}
if(!handled) {
printf("MISSING GLOBAL THINGY\n");
printf(" %d %d %f %s %s\n", (int) evt->chan,
evt->get_type_code(), evt->time,
evt->get_attribute(), evt->get_atom_value() );
// Global stuff
if( !handled ) {
// Write debug output
printf("MISSING GLOBAL HANDLER\n");
printf(" Chn: %d, Type Code: %d, Time: %f", (int) evt->chan,
evt->get_type_code(), evt->time );
if ( evt->is_update() )
{
printf( ", Update Type: %s", evt->get_attribute() );
if ( evt->get_update_type() == 'a' )
{
printf( ", Atom: %s", evt->get_atom_value() );
}
}
printf( "\n" );
}
}
else if( evt->is_note() && evt->chan < 256 )