summaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2013-04-07 14:54:15 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2013-04-07 14:54:15 +0200
commitae208771e8f6f75c655949252f4e9b3a55b6ef8c (patch)
treed1f6d62def6789baa3a315e8722a287da04fd520 /font.c
parentdf4ea104194a19dcb8e525b843dd4fa37f39ff93 (diff)
downloadvdr-ae208771e8f6f75c655949252f4e9b3a55b6ef8c.tar.gz
vdr-ae208771e8f6f75c655949252f4e9b3a55b6ef8c.tar.bz2
Fixed an endless loop in cTextWrapper::Set() in case the given Width is smaller than one character
Diffstat (limited to 'font.c')
-rw-r--r--font.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/font.c b/font.c
index 0bcdc9bb..c6400d4e 100644
--- a/font.c
+++ b/font.c
@@ -6,7 +6,7 @@
*
* BiDi support by Osama Alrawab <alrawab@hotmail.com> @2008 Tripoli-Libya.
*
- * $Id: font.c 2.13 2012/06/02 13:38:28 kls Exp $
+ * $Id: font.c 2.13.1.1 2013/04/07 14:54:15 kls Exp $
*/
#include "font.h"
@@ -592,7 +592,7 @@ void cTextWrapper::Set(const char *Text, const cFont *Font, int Width)
p = Blank;
continue;
}
- else {
+ else if (w > 0) { // there has to be at least one character before the newline
// Here's the ugly part, where we don't have any whitespace to
// punch in a newline, so we need to make room for it:
if (Delim)
@@ -608,8 +608,7 @@ void cTextWrapper::Set(const char *Text, const cFont *Font, int Width)
continue;
}
}
- else
- w += cw;
+ w += cw;
if (strchr("-.,:;!?_", *p)) {
Delim = p;
Blank = NULL;