[ruamoko] Handle missing fonts correctly

Carrying on as if the missing font had been loaded leads to way too many
issues for it to be a good thing (not that that really needs to be
said). Fixes the segfaults in my test scene.
This commit is contained in:
Bill Currie 2023-03-28 13:20:29 +09:00
parent b1de1b8747
commit 9317ce7358

View file

@ -228,9 +228,13 @@ bi (Font_Load)
const char *font_path = P_GSTRING (pr, 0);
int font_size = P_INT (pr, 1);
R_INT (pr) = 0;
QFile *font_file = QFS_FOpenFile (font_path);
font_t *font = Font_Load (font_file, font_size);
R_INT (pr) = alloc_font (res, font);
if (font) {
R_INT (pr) = alloc_font (res, font);
}
}
bi (Font_Free)