From 6655f0c124cef9ff7d01130e27d1b4d3b272ec29 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 30 Jun 2017 10:41:24 +0200 Subject: [PATCH] cc_frm_footer: avoid division by 0 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f7a95bd3acb72eca9528fb8cfe2392d641bb916d Author: vanhofen Date: 2017-06-30 (Fri, 30 Jun 2017) Origin message was: ------------------ - cc_frm_footer: avoid division by 0 ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_footer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 140b74510..af86fb728 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -333,10 +333,14 @@ void CComponentsFooter::paintButtons(const int& x_pos, Font* font, bool do_save_bg) { + int lw = label_width; + if (label_count > 0 && label_width == 0) + lw = (w/label_count) - 2*cch_offset; + this->setDimensionsAll(x_pos, y_pos, w, h); this->setButtonFont(font); this->setContextButton(context_buttons); - this->setButtonLabels(content, label_count, 0, label_width ? label_width : (w/label_count) - 2*cch_offset); + this->setButtonLabels(content, label_count, 0, lw); this->paint(do_save_bg); }