mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-22 03:57:30 +03:00
Type check return value of cache_dir
This commit is contained in:
parent
db0360dc81
commit
726d736aac
@ -403,8 +403,10 @@ ensure_state(DiskCache *self) {
|
||||
if (kc) {
|
||||
cache_dir = PyObject_CallMethod(kc, "cache_dir", NULL);
|
||||
if (cache_dir) {
|
||||
self->cache_dir = strdup(PyUnicode_AsUTF8(cache_dir));
|
||||
if (!self->cache_dir) PyErr_NoMemory();
|
||||
if (PyUnicode_Check(cache_dir)) {
|
||||
self->cache_dir = strdup(PyUnicode_AsUTF8(cache_dir));
|
||||
if (!self->cache_dir) PyErr_NoMemory();
|
||||
} else PyErr_SetString(PyExc_TypeError, "cache_dir() did not return a string");
|
||||
}
|
||||
}
|
||||
Py_CLEAR(kc); Py_CLEAR(cache_dir);
|
||||
|
Loading…
Reference in New Issue
Block a user