Skip to content

Commit 6da8ee2

Browse files
authored
Ensure allocated path is long enough for pssolar (#8261)
See GenericMappingTools/pygmt#2959 for background. Ensure we add at least 1 point when going to pole.
1 parent 9a7850e commit 6da8ee2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/gmt_plot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9704,7 +9704,7 @@ uint64_t gmt_geo_polarcap_segment (struct GMT_CTRL *GMT, struct GMT_DATASEGMENT
97049704
perim_n = gmtlib_lonpath (GMT, start_lon, pole_lat, yc, &x_perim, &y_perim);
97059705
GMT_Report (GMT->parent, GMT_MSG_DEBUG, "Created path from %g/%g to %g/%g [%d points]\n", start_lon, pole_lat, start_lon, yc, perim_n);
97069706
/* 2. Allocate enough space for new polar cap polygon */
9707-
n_new = 2 * perim_n + n;
9707+
n_new = 2 * MAX (perim_n, 1) + n;
97089708
plon = gmt_M_memory (GMT, NULL, n_new, double);
97099709
plat = gmt_M_memory (GMT, NULL, n_new, double);
97109710
/* Start off with the path from the pole to the crossing */

0 commit comments

Comments
 (0)