From d120e592d856f7cd4d9a454706021fbdb97aeb4c Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sun, 24 Dec 2023 13:07:52 +0000 Subject: [PATCH] core: Fix crash when cutting/pasting single layer When cutting and pasting a single layer, drawables->data might be empty. This results in a crash on Windows and a failure to paste on Linux. Since this function is inside an IF statement that already confirms it has a valid image, the base type and precision are retrieved from there instead. --- app/core/gimp-edit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 2e8c620dbc..9382c67056 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -520,8 +520,8 @@ gimp_edit_paste_get_layers (GimpImage *image, } layers = gimp_edit_paste_get_tagged_layers (image, layers, NULL, floating_format, - gimp_drawable_get_base_type (drawables->data), - gimp_drawable_get_precision (drawables->data), + gimp_image_get_base_type (image), + gimp_image_get_precision (image), *paste_type); layers = g_list_reverse (layers); }