Qt: Fix crash when clicking past last tile in viewer

This commit is contained in:
Vicki Pfau 2022-04-12 22:23:08 -07:00
parent 2ce04545b1
commit ac8861a429
2 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,7 @@ Other fixes:
- FFmpeg: Fix GIF recording (fixes mgba.io/i/2393)
- GB, GBA: Save writeback-pending masked saves on unload (fixes mgba.io/i/2396)
- mGUI: Fix FPS counter after closing menu
- Qt: Fix crash when clicking past last tile in viewer
- VFS: Failed file mapping should return NULL on POSIX
Misc:
- GB MBC: Filter out MBC errors when cartridge is yanked (fixes mgba.io/i/2488)

View File

@ -41,7 +41,10 @@ void TilePainter::resizeEvent(QResizeEvent*) {
void TilePainter::mousePressEvent(QMouseEvent* event) {
int x = event->x() / m_size;
int y = event->y() / m_size;
emit indexPressed(y * (width() / m_size) + x);
int index = y * (width() / m_size) + x;
if (index < m_tileCount) {
emit indexPressed(index);
}
}
void TilePainter::clearTile(int index) {