Qt: Fix division by zero error in invalid TilePainter state

This commit is contained in:
Vicki Pfau 2019-12-18 18:23:40 -08:00
parent 1002dfd0db
commit 2cb5a08f4f
2 changed files with 4 additions and 0 deletions

View File

@ -100,6 +100,7 @@ Other fixes:
- Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574)
- Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558)
- Qt: Fix several cases where shader selections don't get saved
- Qt: Fix division by zero error in invalid TilePainter state
Misc:
- GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580)
- SDL: Use controller GUID instead of name

View File

@ -26,6 +26,9 @@ void TilePainter::paintEvent(QPaintEvent* event) {
void TilePainter::resizeEvent(QResizeEvent* event) {
int w = width() / m_size;
if (!w) {
w = 1;
}
int calculatedHeight = (m_tileCount + w - 1) * m_size / w;
calculatedHeight -= calculatedHeight % m_size;
if (width() / m_size != m_backing.width() / m_size || m_backing.height() != calculatedHeight) {