Skip to content

Commit 8bb0ae3

Browse files
committed
Use default value for invalid key instead of NULL
1 parent 6916e77 commit 8bb0ae3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/_png.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ static PyObject *Py_write_png(PyObject *self, PyObject *args, PyObject *kwds)
318318
} else if (PyBytes_Check(meta_key)) {
319319
text[meta_pos].key = PyBytes_AsString(meta_key);
320320
} else {
321-
text[meta_pos].key = NULL; // Silently drops entry
321+
char invalid_key[79];
322+
sprintf(invalid_key,"INVALID KEY %d", meta_pos);
323+
text[meta_pos].key = invalid_key;
322324
}
323325
if (PyUnicode_Check(meta_val)) {
324326
PyObject *temp_val = PyUnicode_AsEncodedString(meta_val, "latin_1", "strict");

0 commit comments

Comments
 (0)