From 0fc78c5738d5a4c9ccd8b76187cbc3f2b13cecaa Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 16 Feb 2013 21:25:02 +0100 Subject: [PATCH] src/gui/infoviewer.cpp: fix div by zero --- src/gui/infoviewer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index e6beea975..e9c3712c6 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -734,7 +734,10 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con prov_name=prov_name.substr(prov_name.find_first_of("]")+1); int chname_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth (ChannelName, true);// UTF-8 - chname_width += (chname_width/(ChannelName.size()-1)/2); + unsigned int chann_size = ChannelName.size(); + if(ChannelName.empty()) + chann_size = 1; + chname_width += (chname_width/chann_size/2); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString( ChanNameX + 10 + ChanNumWidth + chname_width, ChanNameY + time_height -SHADOW_OFFSET/2, BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 - ChanNumWidth - chname_width,