Skip to content

Commit 2ee15e4

Browse files
authored
Fix a crashing situation when reading file with wesn but no -R was used. (#8860)
1 parent 9a72884 commit 2ee15e4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/gmt_grdio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ GMT_LOCAL int gmtgrdio_padspace (struct GMT_CTRL *GMT, struct GMT_GRID_HEADER *h
518518
&& gmtgrdio_eq (wesn[YLO], header->wesn[YLO], header->inc[GMT_Y]) && gmtgrdio_eq (wesn[YHI], header->wesn[YHI], header->inc[GMT_Y]))
519519
return (false); /* Subset equals whole area */
520520
gmt_M_memcpy (P->wesn, wesn, 4, double); /* Copy the subset boundaries */
521+
522+
if (!GMT->common.R.active[RSET]) GMT->common.R.active[RSET] = true; /* This happens when we read a file with a wesn but no -R is set */
523+
521524
if (pad[XLO] == 0 && pad[XHI] == 0 && pad[YLO] == 0 && pad[YHI] == 0) return (false); /* No padding requested */
522525
if (!GMT->current.io.grid_padding) return (false); /* Not requested */
523526

0 commit comments

Comments
 (0)