GUI: prevent division by zero in progress

issue #2570 perhaps?
This commit is contained in:
tildearrow 2025-06-17 03:12:37 -05:00
parent b7c50b272d
commit 5c2647f0ec

View file

@ -5946,7 +5946,12 @@ bool FurnaceGUI::loop() {
*curPosInRowsLambda-=(songLength-songLoopedSectionLength); // a hack so progress bar does not jump?
}
}
*progressLambda=(float)((*curPosInRowsLambda)+((*totalLoopsLambda)-(*loopsLeftLambda))*songLength+lengthOfOneFile*(*curFileLambda))/(float)totalLength;
if (totalLength<0.1) {
// DON'T
*progressLambda=0;
} else {
*progressLambda=(float)((*curPosInRowsLambda)+((*totalLoopsLambda)-(*loopsLeftLambda))*songLength+lengthOfOneFile*(*curFileLambda))/(float)totalLength;
}
}
);
}