From 24ae8e7f8727c12d94cc6cf77aa99a51c9b03a35 Mon Sep 17 00:00:00 2001 From: Joaquim Date: Tue, 2 Jan 2024 16:53:49 +0000 Subject: [PATCH] Do not try to project images that don't have set 'need_to_project'. (#8255) Fixes #8254 --- src/grdimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grdimage.c b/src/grdimage.c index fbb587813c2..bd668f53992 100644 --- a/src/grdimage.c +++ b/src/grdimage.c @@ -1970,7 +1970,7 @@ tr_image: GMT_Report (API, GMT_MSG_INFORMATION, "Project the input image\n"); gmt_set_grddim (GMT, Img_proj->header); /* Recalculate projected image dimensions */ if (GMT_Create_Data (API, GMT_IS_IMAGE, GMT_IS_SURFACE, GMT_DATA_ONLY, NULL, NULL, NULL, 0, 0, Img_proj) == NULL) Return (API->error); /* Failed to allocate memory for the projected image */ - if (gmt_img_project (GMT, I, Img_proj, false)) Return (GMT_RUNTIME_ERROR); /* Now project the image onto the projected rectangle */ + if (need_to_project && gmt_img_project (GMT, I, Img_proj, false)) Return (GMT_RUNTIME_ERROR); /* Now project the image onto the projected rectangle */ if (!API->external && (GMT_Destroy_Data (API, &I) != GMT_NOERROR)) { /* Free the original image now we have projected. Use Img_proj from now on */ Return (API->error); /* Failed to free the image */ }