From 5c2647f0ecf9e0e7bfb3ce725429f99eb5838c2f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 17 Jun 2025 03:12:37 -0500 Subject: [PATCH] GUI: prevent division by zero in progress issue #2570 perhaps? --- src/gui/gui.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 74b1a82af..dbeaa8308 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -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; + } } ); }