fix for #2783, Return none without error set

This commit is contained in:
Eric Soroos 2017-10-04 10:56:20 +00:00
parent 5e159c2ff4
commit 87abdf5e6d

View File

@ -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