Skip to content

Commit 5dcc7c9

Browse files
committed
fixed issue #21 (small image + normal map size 10% -> crash)
1 parent 1c68fdd commit 5dcc7c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src_gui/mainwindow.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,11 @@ void MainWindow::normalmapSizeChanged() {
899899
ui->label_normalmapSize->setText(text);
900900
}
901901

902+
// Used to scale down the input image if a value less than 100
903+
// is set in spinBox_normalmapSize. We have to make sure size is at least 1
902904
int MainWindow::calcPercentage(int value, int percentage) {
903-
return (int) (((double)value / 100.0) * percentage);
905+
const int newValue = (((double)value / 100.0) * percentage);
906+
return std::max(newValue, 1);
904907
}
905908

906909
void MainWindow::showAboutDialog() {

0 commit comments

Comments
 (0)