Skip to content

Commit dee0e0c

Browse files
committed
Plugins (gforce): Be more helpful about font loading errors
Note that lv-tool currently needs to to be invoked with "-v" to display warnings. (cherry picked from commit 24d4ea7)
1 parent f1b5a56 commit dee0e0c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • libvisual-plugins/plugins/actor/gforce/unix/libmfl

libvisual-plugins/plugins/actor/gforce/unix/libmfl/mfl.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ mfl_font mfl_LoadRawFont(const char *fname) {
5151

5252
/* Open font file */
5353
ff = fopen(fname, "rb");
54-
if (ff == NULL) goto lrf_open_fault;
54+
if (ff == NULL) {
55+
visual_log (VISUAL_LOG_WARNING, "Unable to open font file: %s", fname);
56+
goto lrf_open_fault;
57+
}
5558

5659
/* Get length of font file */
5760
if (fseek(ff, 0, SEEK_END) != 0) goto lrf_fault;
@@ -70,6 +73,7 @@ mfl_font mfl_LoadRawFont(const char *fname) {
7073

7174
/* Read font data */
7275
if (fread(f->data, 1, l, ff) != l) {
76+
visual_log (VISUAL_LOG_WARNING, "Unable to fully read font file: %s", fname);
7377
free(f->data);
7478
free(f);
7579
f = NULL;
@@ -84,7 +88,9 @@ mfl_font mfl_LoadRawFont(const char *fname) {
8488
}
8589

8690
void mfl_DestroyFont(mfl_font f) {
87-
visual_return_if_fail(f != NULL);
91+
if (f == NULL) {
92+
return;
93+
}
8894
free(f->data);
8995
free(f);
9096
}

0 commit comments

Comments
 (0)