]> granicus.if.org Git - postgis/commitdiff
Make ST_AsGeoBuf more resiliant when fed rows including NULL geometry (Closes #3861)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 22 Sep 2017 19:06:58 +0000 (19:06 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 22 Sep 2017 19:06:58 +0000 (19:06 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@15797 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geobuf.c

index e677be18c8050947809b740a847ada25139c28ad..3c00ff2e62b693ce5d56f7917816d42d2e8daf9c 100644 (file)
@@ -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);