--Bug fixes

-Clicking random palette when using a palette file with only two entries in it could lead to a program freeze.
This commit is contained in:
Person 2017-12-22 20:07:24 -08:00
parent b315c1d35b
commit 3f83b49cf0
2 changed files with 4 additions and 4 deletions

View File

@ -274,9 +274,9 @@ void Fractorium::OnPaletteCellDoubleClicked(int row, int col)
void Fractorium::OnPaletteRandomSelectButtonClicked(bool checked)
{
uint i = 0;
int rowCount = ui.PaletteListTable->rowCount() - 1;
int rowCount = ui.PaletteListTable->rowCount();
while ((i = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(rowCount)) == uint(m_PreviousPaletteRow));
while (((i = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(rowCount)) == uint(m_PreviousPaletteRow)) || i >= uint(rowCount));
if (checked)
OnPaletteCellDoubleClicked(i, 1);//Will clear the adjustments.

View File

@ -567,8 +567,8 @@ map<float, GradientArrow> PaletteEditor::GetRandomColorsFromImage(QString filena
for (int i = 0; i < numPoints; i++)
{
int x = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand() % image.width();
int y = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand() % image.height();
int x = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(image.width());
int y = QTIsaac<ISAAC_SIZE, ISAAC_INT>::LockedRand(image.height());
QRgb rgb = image.pixel(x, y);
GradientArrow arrow;
arrow.Color(QColor::fromRgb(rgb));