From 2fd6bf7442ce01cd52d344b3e1cd35defdd8cdd8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Dec 2020 18:41:47 +0530 Subject: [PATCH] Fix failing test Error responses must be sent for put commands that refer non-existent images --- kitty/graphics.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/graphics.c b/kitty/graphics.c index 69c027320..9c5c9ef44 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -574,9 +574,9 @@ handle_put_command(GraphicsManager *self, const GraphicsCommand *g, Cursor *c, b if (img == NULL) { if (g->id) img = img_by_client_id(self, g->id); else if (g->image_number) img = img_by_client_number(self, g->image_number); - if (img == NULL) { set_command_failed_response("ENOENT", "Put command refers to non-existent image with id: %u and number: %u", g->id, g->image_number); return 0; } + if (img == NULL) { set_command_failed_response("ENOENT", "Put command refers to non-existent image with id: %u and number: %u", g->id, g->image_number); return g->id; } } - if (!img->data_loaded) { set_command_failed_response("ENOENT", "Put command refers to image with id: %u that could not load its data", g->id); return 0; } + if (!img->data_loaded) { set_command_failed_response("ENOENT", "Put command refers to image with id: %u that could not load its data", g->id); return img->client_id; } ensure_space_for(img, refs, ImageRef, img->refcnt + 1, refcap, 16, true); *is_dirty = true; self->layers_dirty = true;