From 7355e672ae1d7a0b496a6648116d56dd506fa762 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 5 May 2024 23:37:22 +0800 Subject: [PATCH] Fix crash when executing Image.save_jpg_to_buffer --- modules/jpg/image_loader_jpegd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index ada0cd01fab..53046de7405 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -162,7 +162,7 @@ static Error _jpgd_save_to_output_stream(jpge::output_stream *p_output_stream, c ERR_FAIL_COND_V_MSG(error != OK, error, "Couldn't decompress image."); } if (image->get_format() != Image::FORMAT_RGB8) { - image = p_img->duplicate(); + image = image->duplicate(); image->convert(Image::FORMAT_RGB8); }