MidiTime/Pattern: fixed divisions by zero with time sigs 1/16+
Setting time signatures 1/16+ lead to divisions by zero in two places.
Fixed this by adding according qMax() call (closes #2818125).
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
(cherry picked from commit cb72bf2260)
This commit is contained in:
@@ -135,7 +135,7 @@ public:
|
||||
|
||||
static int stepsPerTact( void )
|
||||
{
|
||||
return ticksPerTact() / DefaultBeatsPerTact;
|
||||
return qMax( 1, ticksPerTact() / DefaultBeatsPerTact );
|
||||
}
|
||||
|
||||
static void setTicksPerTact( tick_t _tpt )
|
||||
|
||||
@@ -1243,7 +1243,8 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
QPixmap stepoverlay;
|
||||
QPixmap stepoff;
|
||||
QPixmap stepoffl;
|
||||
const int steps = m_pat->length() / DefaultBeatsPerTact;
|
||||
const int steps = qMax( 1,
|
||||
m_pat->length() / DefaultBeatsPerTact );
|
||||
const int w = width() - 2 * TCO_BORDER_WIDTH;
|
||||
stepon = s_stepBtnOn->scaled( w / steps,
|
||||
s_stepBtnOn->height(),
|
||||
|
||||
Reference in New Issue
Block a user