mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
pnmtext: Fix loading an invalid font resulting in a crash
Related to #1140
This commit is contained in:
parent
addbc8a2e8
commit
4a7d03d9b1
@ -108,13 +108,15 @@ load_font(const Filename &font_filename, int face_index) {
|
|||||||
vfs->resolve_filename(path, get_model_path());
|
vfs->resolve_filename(path, get_model_path());
|
||||||
exists = vfs->read_file(path, _face->_font_data, true);
|
exists = vfs->read_file(path, _face->_font_data, true);
|
||||||
if (exists) {
|
if (exists) {
|
||||||
FT_Face face;
|
FT_Face face = 0;
|
||||||
error = FT_New_Memory_Face(_face->_ft_library,
|
error = FT_New_Memory_Face(_face->_ft_library,
|
||||||
(const FT_Byte *)_face->_font_data.data(),
|
(const FT_Byte *)_face->_font_data.data(),
|
||||||
_face->_font_data.length(),
|
_face->_font_data.length(),
|
||||||
face_index, &face);
|
face_index, &face);
|
||||||
|
if (face) {
|
||||||
_face->set_face(face);
|
_face->set_face(face);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool okflag = false;
|
bool okflag = false;
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user