]> granicus.if.org Git - postgis/commitdiff
Gracefully handle typos in style names for docs images
authorSandro Santilli <strk@keybit.net>
Thu, 22 Jan 2015 16:12:40 +0000 (16:12 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 22 Jan 2015 16:12:40 +0000 (16:12 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@13194 b70326c6-7e19-0410-871a-916f4a2858ee

doc/html/image_src/generator.c

index cb4551656c2c9b5d9d7eea33685b7bc005e73213..c08c318adf24660aeba24036c17413376d60d574 100644 (file)
@@ -371,6 +371,7 @@ int main( int argc, const char* argv[] )
                char output[32768];
                char *ptr = output;
                char *styleName;
+               LAYERSTYLE *style;
                int useDefaultStyle;
 
                ptr += sprintf( ptr, "convert -size %s xc:none ", imageSize );
@@ -387,7 +388,12 @@ int main( int argc, const char* argv[] )
                        lwgeom = lwgeom_from_wkt( line+strlen(styleName)+1, LW_PARSER_CHECK_NONE );
                LWDEBUGF( 4, "geom = %s", lwgeom_to_ewkt((LWGEOM*)lwgeom) );
 
-               ptr += drawGeometry( ptr, lwgeom, getStyle(styles, styleName) );
+               style = getStyle(styles, styleName);
+               if ( ! style ) {
+                 lwerror("Could not find style named %s", styleName);
+                 return -1;
+               }
+               ptr += drawGeometry( ptr, lwgeom, style );
 
                ptr += sprintf( ptr, "-flip tmp%d.png", layerCount );