Return early if image is null

This commit is contained in:
Andrew Murray 2023-06-15 14:27:33 +10:00
parent 594fbf79b8
commit 618c00c4ea

View File

@ -887,6 +887,10 @@ font_render(FontObject *self, PyObject *args) {
}
image = PyObject_CallFunction(fill, "s(ii)", strcmp(mode, "RGBA") == 0 ? "RGBA" : "L", width, height);
if (image == NULL) {
PyMem_Del(glyph_info);
return NULL;
}
id = PyLong_AsSsize_t(PyObject_GetAttrString(image, "id"));
im = (Imaging)id;