Skip to content

Commit

Permalink
add missing map reference to image
Browse files Browse the repository at this point in the history
When msCreateLegendIcon and msDrawLegendIcon are called from mapscript directly, the image does not have a map assigned. This causes a crash when the legend references a symbol as in the maprendering.c getTile function and tries to get the font from the image's map fontset reference.
  • Loading branch information
zidge authored and tbonfort committed Mar 7, 2014
1 parent 59019b6 commit 814286d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion maplegend.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *theclass,

image_draw = msImageCreate(image->width, image->height,
altFormat, image->imagepath, image->imageurl, map->resolution, map->defresolution, &map->imagecolor);
image_draw->map = map;
renderer = MS_IMAGE_RENDERER(image_draw);
} else {
renderer = MS_IMAGE_RENDERER(image_draw);
Expand All @@ -83,7 +84,8 @@ int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *theclass,
"msDrawLegendIcon()");
return (MS_FAILURE);
}
/* set opacity to full, as the renderer should be rendering a fully opaque image */
image_draw->map = map;
/* set opacity to full, as the renderer should be rendering a fully opaque image */
lp->opacity=100;
}
}
Expand Down Expand Up @@ -406,6 +408,7 @@ imageObj *msCreateLegendIcon(mapObj* map, layerObj* lp, classObj* class, int wid
msSetError(MS_IMGERR, "Unable to initialize image.","msCreateLegendIcon()");
return(NULL);
}
image->map = map;

/* Call drawLegendIcon with destination (0, 0) */
/* Return an empty image if lp==NULL || class=NULL */
Expand Down

0 comments on commit 814286d

Please sign in to comment.