Bug fix for vector overrun in Qt TAS editor piano roll.

This commit is contained in:
mjbudd77 2021-11-24 13:13:22 -05:00
parent abf980fd75
commit 67fb525e5c
1 changed files with 4 additions and 1 deletions

View File

@ -3146,6 +3146,7 @@ void QPianoRoll::mousePressEvent(QMouseEvent * event)
{
fceuCriticalSection emuLock;
int col, line, row_index, column_index, kbModifiers, alt_pressed;
bool row_valid;
QPoint c = convPixToCursor( event->pos() );
mouse_x = event->pos().x();
@ -3158,6 +3159,8 @@ void QPianoRoll::mousePressEvent(QMouseEvent * event)
rowUnderMouse = realRowUnderMouse = line;
columnUnderMouse = column_index = col;
row_valid = (row_index >= 0) && ( (size_t)row_index < currMovieData.records.size() );
kbModifiers = QApplication::keyboardModifiers();
alt_pressed = (kbModifiers & Qt::AltModifier) ? 1 : 0;
@ -3277,7 +3280,7 @@ void QPianoRoll::mousePressEvent(QMouseEvent * event)
if (taseditorConfig->drawInputByDragging)
{
// if clicked this click created buttonpress, then start painting, else start erasing
if (currMovieData.records[row_index].checkBit(joy, button))
if ( row_valid && currMovieData.records[row_index].checkBit(joy, button))
{
dragMode = DRAG_MODE_SET;
}