Skip to content

Commit

Permalink
avoid segfault when font file could not be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort committed Sep 27, 2012
1 parent 5066401 commit fc70e2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion maplabel.c
Expand Up @@ -223,7 +223,12 @@ char *msAlignText(mapObj *map, labelObj *label, char *text)
/*length in pixels of the longest line*/
maxlinelength=0;
for(i=0; i<numlines; i++) {
msGetLabelSize(map,label,textlines[i],label->size, &label_rect,NULL);
if(MS_SUCCESS != msGetLabelSize(map,label,textlines[i],label->size, &label_rect,NULL)) {
msFreeCharArray(textlines,numlines);
msFree(textlinelengths);
msFree(numspacesforpadding);
return text;
}
textlinelengths[i] = label_rect.maxx-label_rect.minx;
if(maxlinelength<textlinelengths[i])
maxlinelength=textlinelengths[i];
Expand Down

0 comments on commit fc70e2c

Please sign in to comment.