8000 Use default value for invalid key instead of NULL · matplotlib/matplotlib@8bb0ae3 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Lines changed: 3 additions & 1 deletion
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)
0