[MIDI Input] No longer crash when seeking to the end

When seeking to the end of a file, no longer crash due to out
of range std::vector access, because it was using at() with an
offset of the array size. Instead, offset from the begin()
iterator return value, which allows offsetting to end().

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
lastfm
Christopher Snowhill 2022-07-02 03:19:24 -07:00
parent 321e3382f4
commit a847cbde3b
1 changed files with 1 additions and 1 deletions

View File

@ -266,7 +266,7 @@ void MIDIPlayer::Seek(unsigned long sample) {
if(uStreamPosition > stream_start) {
filler.resize(uStreamPosition - stream_start);
filler.assign(&mStream.at(stream_start), &mStream.at(uStreamPosition));
filler.assign(mStream.begin() + stream_start, mStream.begin() + uStreamPosition);
unsigned long i, j;