Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46ebe0a

Browse files
committed
ft2font null checks added
1 parent 60383ac commit 46ebe0a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/ft2font.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ inline char const* ft_error_string(FT_Error error) {
4141
#undef __FTERRORS_H__
4242
#define FT_ERROR_START_LIST switch (error) {
4343
#define FT_ERRORDEF( e, v, s ) case v: return s;
44-
#define FT_ERROR_END_LIST default: return NULL; }
44+
#define FT_ERROR_END_LIST default: return "unknown error"; }
4545
#include FT_ERRORS_H
4646
}
4747

src/ft2font_wrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,9 @@ class PyFT2Font final : public FT2Font
409409
{
410410
std::set<FT_String*>::iterator it = family_names.begin();
411411
std::stringstream ss;
412-
ss<<*it;
412+
ss<< (*it ? *it : "unknown family name");
413413
while(++it != family_names.end()){
414-
ss<<", "<<*it;
414+
ss<<", "<< (*it ? *it : "unknown family name");
415415
}
416416

417417
auto text_helpers = py::module_::import("matplotlib._text_helpers");

0 commit comments

Comments
 (0)