From 685272bf037ef7c98121dcbe130c23b9e4bf4bae Mon Sep 17 00:00:00 2001 From: Pierre Racine Date: Wed, 23 Mar 2011 22:09:59 +0000 Subject: [PATCH] -Return NULL if raster is NULL in RASTER_addband -Warn if first raster is NULL in RASTER_copyband and return NULL git-svn-id: http://svn.osgeo.org/postgis/trunk@6964 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rt_pg.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/raster/rt_pg/rt_pg.c b/raster/rt_pg/rt_pg.c index a6bdeecf7..decb44a2a 100644 --- a/raster/rt_pg/rt_pg.c +++ b/raster/rt_pg/rt_pg.c @@ -1770,6 +1770,11 @@ Datum RASTER_addband(PG_FUNCTION_ARGS) } /* Deserialize raster */ + if (PG_ARGISNULL(0)) { + /* Simply return NULL */ + elog(NOTICE, "Raster can not be NULL. Returning NULL"); + PG_RETURN_NULL(); + } pgraster = (rt_pgraster *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)); ctx = get_rt_context(fcinfo); @@ -1850,8 +1855,11 @@ Datum RASTER_copyband(PG_FUNCTION_ARGS) rt_context ctx = NULL; /* Deserialize torast */ - if (PG_ARGISNULL(0)) + if (PG_ARGISNULL(0)) { + /* Simply return NULL */ + elog(NOTICE, "First raster can not be NULL. Returning NULL"); PG_RETURN_NULL(); + } pgraster = (rt_pgraster *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)); ctx = get_rt_context(fcinfo); -- 2.50.1