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>
This commit is contained in:
Tobias Doerffel
2009-07-10 17:47:37 +02:00
parent c4c94985a6
commit cb72bf2260
2 changed files with 3 additions and 2 deletions

View File

@@ -135,7 +135,7 @@ public:
static int stepsPerTact( void )
{
return ticksPerTact() / DefaultBeatsPerTact;
return qMax( 1, ticksPerTact() / DefaultBeatsPerTact );
}
static void setTicksPerTact( tick_t _tpt )

View File

@@ -1244,7 +1244,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(),