From 87abdf5e6d0627fd10f54b5a14e7f45ab05f7891 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Wed, 4 Oct 2017 10:56:20 +0000 Subject: [PATCH] fix for #2783, Return none without error set --- _imaging.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/_imaging.c b/_imaging.c index ee2c3e897..ab0ffd916 100644 --- a/_imaging.c +++ b/_imaging.c @@ -2212,16 +2212,15 @@ void _font_text_asBytes(PyObject* encoded_string, unsigned char** text){ PyBytes_AsStringAndSize(encoded_string, &buffer, &len); } - if (len) { - *text = calloc(len,1); - if (*text) { - memcpy(*text, buffer, len); - } - if(bytes) { - Py_DECREF(bytes); - } - return; + *text = calloc(len,1); + if (*text) { + memcpy(*text, buffer, len); } + if(bytes) { + Py_DECREF(bytes); + } + + return; #if PY_VERSION_HEX < 0x03000000