From c806c8317ac167fe5737b86731873f6ac04f44e1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 20 Oct 2021 10:15:31 +0200 Subject: [PATCH] hourglass.cpp: simplify constructor supplement to: hourglass.cpp: Avoid division by zero if no images are available. b4a3d19c9fa503560b52a49018a8cea6a22f94bb --- src/gui/widget/hourglass.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/hourglass.cpp b/src/gui/widget/hourglass.cpp index cf6a5a3b2..dac2b418d 100644 --- a/src/gui/widget/hourglass.cpp +++ b/src/gui/widget/hourglass.cpp @@ -55,6 +55,9 @@ CHourGlass::CHourGlass( const int x_pos, initImageFiles(); hg_file_num = 0; + hg_interval = 0; + hg_timer = NULL; + if (!hg_img_files.empty()) { hg_interval = interval == HG_AUTO_PAINT_INTERVAL ? (int64_t)(1000/hg_img_files.size()) : interval; @@ -62,11 +65,7 @@ CHourGlass::CHourGlass( const int x_pos, hg_timer->OnTimer.connect(sigc::bind(sigc::mem_fun(*this, &CHourGlass::paint), true)); } else - { - hg_interval = 0; - hg_timer = NULL; dprintf(DEBUG_NORMAL, "[CHourGlass] [%s - %d] NOTE: No %s-images found..\n", __func__, __LINE__, hg_image_basename.c_str()); - } } CHourGlass::~CHourGlass()