From: Paul Ramsey Date: Fri, 22 Sep 2017 19:06:58 +0000 (+0000) Subject: Make ST_AsGeoBuf more resiliant when fed rows including NULL geometry (Closes #3861) X-Git-Tag: 2.4.0rc2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82bda72b000779c5901f29da8cf7ef578f3d06da;p=postgis Make ST_AsGeoBuf more resiliant when fed rows including NULL geometry (Closes #3861) git-svn-id: http://svn.osgeo.org/postgis/trunk@15797 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geobuf.c b/postgis/geobuf.c index e677be18c..3c00ff2e6 100644 --- a/postgis/geobuf.c +++ b/postgis/geobuf.c @@ -560,7 +560,7 @@ void geobuf_agg_init_context(struct geobuf_agg_context *ctx) void geobuf_agg_transfn(struct geobuf_agg_context *ctx) { LWGEOM *lwgeom; - bool isnull; + bool isnull = false; Datum datum; Data__FeatureCollection *fc = ctx->data->feature_collection; Data__Feature **features = fc->features; @@ -580,8 +580,9 @@ void geobuf_agg_transfn(struct geobuf_agg_context *ctx) encode_keys(ctx); datum = GetAttributeByNum(ctx->row, ctx->geom_index + 1, &isnull); - if (!datum) - elog(ERROR, "geobuf_agg_transfn: geometry column cannot be null"); + if (isnull) + return; + gs = (GSERIALIZED *) PG_DETOAST_DATUM_COPY(datum); lwgeom = lwgeom_from_gserialized(gs);