summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-11-04 11:11:34 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2007-11-04 11:11:34 +0100
commitc01249ffe5ef1a98e309f5857ba8724f59163391 (patch)
treec5bd41837ae2326df4e219c055208072d86b9347
parent7823790beb2f16d93b59dd4dbc6c8112fb3bc97d (diff)
downloadvdr-c01249ffe5ef1a98e309f5857ba8724f59163391.tar.gz
vdr-c01249ffe5ef1a98e309f5857ba8724f59163391.tar.bz2
Fixed a crash if no fonts are found
-rw-r--r--CONTRIBUTORS4
-rw-r--r--HISTORY2
-rw-r--r--font.c26
3 files changed, 21 insertions, 11 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index a5ac694e..76572ef5 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -744,6 +744,7 @@ Georg Hitsch <georg@hitsch.at>
Clemens Kirchgatterer <clemens@thf.ath.cx>
for suggesting to change source directory name for plugins from 'SRC' to 'src'
for reporting a problem with user defined CFLAGS in libdtv/libvdr/Makefile
+ for suggesting an error log message if no fonts are found
Emil Naepflein <Emil.Naepflein@philosys.de>
for suggesting to take an active SVDRP connection into account when doing shutdown or
@@ -2231,3 +2232,6 @@ Yarema Aka Knedlyk <yupadmin@gmail.com>
Lauri Nurmi <lanurmi@iki.fi>
for adding a missing '.' to the date returned by DayDateTime()
+
+Mario Ivankovits <mario@ops.co.at>
+ for fixing a crash if no fonts are found
diff --git a/HISTORY b/HISTORY
index 7bc48aa9..6270c7cc 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5514,3 +5514,5 @@ Video Disk Recorder Revision History
Stefan Huelswitt). The 'newplugin' and 'i18n-to-gettext.pl' scripts have been
changed accordingly. Plugin authors may want to adjust the 'i18n' target
of their Makefiles.
+- Fixed a crash if no fonts are found (thanks to Mario Ivankovits and Clemens
+ Kirchgatterer).
diff --git a/font.c b/font.c
index 19753bfc..73b77fbb 100644
--- a/font.c
+++ b/font.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: font.c 1.21 2007/06/23 11:25:42 kls Exp $
+ * $Id: font.c 1.22 2007/11/04 11:08:12 kls Exp $
*/
#include "font.h"
@@ -395,17 +395,21 @@ cString cFont::GetFontFileName(const char *FontName)
FcConfigSubstitute(NULL, pat, FcMatchPattern);
FcDefaultSubstitute(pat);
FcFontSet *fontset = FcFontSort(NULL, pat, FcFalse, NULL, NULL);
- for (int i = 0; i < fontset->nfont; i++) {
- FcBool scalable;
- FcPatternGetBool(fontset->fonts[i], FC_SCALABLE, 0, &scalable);
- if (scalable) {
- FcChar8 *s = NULL;
- FcPatternGetString(fontset->fonts[i], FC_FILE, 0, &s);
- FontFileName = (char *)s;
- break;
+ if (fontset) {
+ for (int i = 0; i < fontset->nfont; i++) {
+ FcBool scalable;
+ FcPatternGetBool(fontset->fonts[i], FC_SCALABLE, 0, &scalable);
+ if (scalable) {
+ FcChar8 *s = NULL;
+ FcPatternGetString(fontset->fonts[i], FC_FILE, 0, &s);
+ FontFileName = (char *)s;
+ break;
+ }
}
- }
- FcFontSetDestroy(fontset);
+ FcFontSetDestroy(fontset);
+ }
+ else
+ esyslog("ERROR: no usable font found for '%s'", FontName);
FcPatternDestroy(pat);
free(fn);
FcFini();