commit c05dbadab21b7f824e9f827c2b9388ca39410a22 parent 01a9fbd72b6104529babb28d11f5f1cb481b96c6 Author: freddyz <[email protected]> Date: Tue, 2 Mar 2021 14:26:34 -0600 dont do Blank gif setup stuff if the image isnt a gif Diffstat:
M | src/ComputerscareBlank.cpp | | | 19 | +++++++++++++------ |
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp @@ -900,12 +900,19 @@ struct tPNGDisplay : TBase { gifBuddy = AnimatedGifBuddy(args.vg, badGifPath.c_str()); } img = gifBuddy.getHandle(); - - blankModule->setFrameCount(gifBuddy.getFrameCount()); - blankModule->setFrameDelays(gifBuddy.getAllFrameDelaysSeconds()); - blankModule->setTotalGifDuration(gifBuddy.getTotalGifDuration()); - blankModule->setTotalGifDurationIfInPingPongMode(gifBuddy.getPingPongGifDuration()); - blankModule->setFrameDelay(gifBuddy.getSecondsDelay(0)); + int numImageFrames = gifBuddy.getFrameCount(); + + blankModule->setFrameCount(numImageFrames); + + //if this check isnt performed, windows crashes with non-gifs due to + //the call to vector insert + if(numImageFrames > 1) { + blankModule->setFrameCount(gifBuddy.getFrameCount()); + blankModule->setFrameDelays(gifBuddy.getAllFrameDelaysSeconds()); + blankModule->setTotalGifDuration(gifBuddy.getTotalGifDuration()); + blankModule->setTotalGifDurationIfInPingPongMode(gifBuddy.getPingPongGifDuration()); + blankModule->setFrameDelay(gifBuddy.getSecondsDelay(0)); + } blankModule->setImageStatus(gifBuddy.getImageStatus()); blankModule->setContainingDirectory(); blankModule->setReady(true);