libmid: fix empty event bug in merge_tracks