From b3ebcb7895ec67469a67dff253dca90aba65111e Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 6 Jan 2021 00:45:28 -0800 Subject: load_cache: fix divzero bug introduced by 5ce6553 --rescue mode doesn't set pdata->capture_frameno to the total The whole --rescue initialization path is a snowflake and should get reworked to share more in common with the normal startup. reported by @xloem, thanks! --- src/rmd_load_cache.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rmd_load_cache.c b/src/rmd_load_cache.c index 303cc3b..5e5b8f7 100644 --- a/src/rmd_load_cache.c +++ b/src/rmd_load_cache.c @@ -217,8 +217,12 @@ void *rmdLoadCache(ProgData *pdata) if (read_header(frame.header, icf)) { - fprintf(stdout, "\r[%d%%] ", - ((frame.header->capture_frameno) * 100) / pdata->capture_frameno); + if (pdata->capture_frameno) + fprintf(stdout, "\r[%d%%] ", + ((frame.header->capture_frameno) * 100) / pdata->capture_frameno); + else + fprintf(stdout, "\r[%d frames rendered] ", + frame.header->capture_frameno); if (icf->chapter) fprintf(stdout, "\t[Cache File %d]", icf->chapter); fflush(stdout); -- cgit v1.2.3