mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-11 14:45:31 +03:00
Fix loading of window logo images via @launch
Use the path when either the pointer ORE the size is false. Apparently some code paths pass pointers from a python y# conversion with an empty bytestring as no value. Fixes #6844
This commit is contained in:
parent
c2b4df0666
commit
6a09804910
@ -1153,7 +1153,7 @@ pyset_background_image(PyObject *self UNUSED, PyObject *args) {
|
||||
bgimage = calloc(1, sizeof(BackgroundImage));
|
||||
if (!bgimage) return PyErr_NoMemory();
|
||||
bool ok;
|
||||
if (png_data) {
|
||||
if (png_data && png_data_size) {
|
||||
ok = png_from_data(png_data, png_data_size, path, &bgimage->bitmap, &bgimage->width, &bgimage->height, &size);
|
||||
} else {
|
||||
ok = png_path_to_bitmap(path, &bgimage->bitmap, &bgimage->width, &bgimage->height, &size);
|
||||
@ -1274,7 +1274,7 @@ pymouse_selection(PyObject *self UNUSED, PyObject *args) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYWRAP1(set_window_logo) {
|
||||
PYWRAP1(sotet_window_logo) {
|
||||
id_type os_window_id, tab_id, window_id;
|
||||
const char *path; PyObject *position;
|
||||
float alpha = 0.5;
|
||||
|
@ -63,7 +63,7 @@ find_or_create_window_logo(WindowLogoTable *head, const char *path, void *png_da
|
||||
s->path = strdup(path);
|
||||
if (!s->path) { free(s); PyErr_NoMemory(); return 0; }
|
||||
bool ok = false;
|
||||
if (png_data == NULL) {
|
||||
if (png_data == NULL || !png_data_size) {
|
||||
ok = png_path_to_bitmap(path, &s->wl.bitmap, &s->wl.width, &s->wl.height, &size);
|
||||
} else {
|
||||
ok = png_from_data(png_data, png_data_size, path, &s->wl.bitmap, &s->wl.width, &s->wl.height, &size);
|
||||
|
Loading…
Reference in New Issue
Block a user