aboutsummaryrefslogtreecommitdiff
path: root/core/qmpmidiread.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-01 23:49:05 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-01 23:49:05 +0800
commit85ccf22f3d2340e80ce2a109bbe610da1b92ca7d (patch)
tree8127dc287d9a4df6a6c7985e55087491153b5523 /core/qmpmidiread.cpp
parent90f018721ae7ee6ac154d757516378b9c45ec1bf (diff)
downloadQMidiPlayer-85ccf22f3d2340e80ce2a109bbe610da1b92ca7d.tar.xz
Give the visualization a clearer look...
Now highlights playing notes. Avoid a crash in file reading.
Diffstat (limited to 'core/qmpmidiread.cpp')
-rw-r--r--core/qmpmidiread.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/qmpmidiread.cpp b/core/qmpmidiread.cpp
index 380b603..9b1d932 100644
--- a/core/qmpmidiread.cpp
+++ b/core/qmpmidiread.cpp
@@ -172,10 +172,13 @@ int CMidiFile::eventReader()//returns 0 if End of Track encountered
error(0,"W: Unknown event type %#x",type);
}
lasttype=type;++curid;
- SEvent* le=eventList[eventList.size()-1];
- SEventCallBackData cbd(le->type,le->p1,le->p2,le->time);
- for(int i=0;i<16;++i)if(eventReaderCB[i])
- eventReaderCB[i]->callBack(&cbd,eventReaderCBuserdata[i]);
+ if(eventList.size())
+ {
+ SEvent* le=eventList[eventList.size()-1];
+ SEventCallBackData cbd(le->type,le->p1,le->p2,le->time);
+ for(int i=0;i<16;++i)if(eventReaderCB[i])
+ eventReaderCB[i]->callBack(&cbd,eventReaderCBuserdata[i]);
+ }
return 1;
}
void CMidiFile::trackChunkReader()