Skip to content

Commit

Permalink
Fix possible divide by zero identified by Coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed May 10, 2012
1 parent 46bcb72 commit 53c2234
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mythtv/libs/libmythui/mythuitext.cpp
Expand Up @@ -601,8 +601,8 @@ bool MythUIText::GetNarrowWidth(const QStringList & paragraphs,
MythRect textrect(m_Area);
qreal height, last_line_width, lines;
int best_width, too_narrow, last_width = -1;
int num_lines, line_height;
int attempt;
int num_lines, line_height = 0;
int attempt = 0;
Qt::TextElideMode cutdown = m_Cutdown;
m_Cutdown = Qt::ElideNone;

Expand All @@ -621,6 +621,9 @@ bool MythUIText::GetNarrowWidth(const QStringList & paragraphs,
LayoutParagraphs(paragraphs, textoption, width, height,
min_rect, last_line_width, num_lines, false);

if (num_lines <= 0)
return false;

if (height > m_drawRect.height())
{
if (too_narrow < width)
Expand Down

0 comments on commit 53c2234

Please sign in to comment.