]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
label-freetype: Don't bother loading fallback font if it doesn't exist
authorRay Strode <rstrode@redhat.com>
Thu, 28 Dec 2023 17:15:20 +0000 (12:15 -0500)
committerRay Strode <halfline@gmail.com>
Thu, 28 Dec 2023 17:31:48 +0000 (17:31 +0000)
If the fallback font doesn't exist, we shouldn't even try to load it,
there's no point.

Instead, put a nice error in the log.

src/plugins/controls/label-freetype/plugin.c

index 403541f479718888a58ebb94febfd415f98ea6aa..02b6f899ab3a22e7cf57710f3e65ebef12419735 100644 (file)
@@ -165,6 +165,11 @@ set_font_with_fallback (ply_label_plugin_control_t *label,
         if (fallback_font_path != NULL && error != 0) {
                 ply_trace ("Could not load font '%s', trying fallback font '%s' (error %d)",
                            primary_font_path?: "(unset)", fallback_font_path, (int) error);
+
+                if (!ply_file_exists (fallback_font_path)) {
+                        ply_trace ("Fallback font '%s' does not exist!", fallback_font_path);
+                        return error;
+                }
                 error = FT_New_Face (label->library, fallback_font_path, 0, &label->face);
         }