diff --git a/mapdraw.c b/mapdraw.c index 1d07d74be9..5fc1bd4bf3 100644 --- a/mapdraw.c +++ b/mapdraw.c @@ -1362,7 +1362,7 @@ int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image) } for(i=0; inumclasses; i++) { - if(layer->type == MS_LAYER_POLYGON) { /* alter BOTTOM style since that's almost always the fill */ + if(layer->type == MS_LAYER_POLYGON && layer->class[i]->numstyles > 0) { /* alter BOTTOM style since that's almost always the fill */ if (layer->class[i]->styles == NULL) { msSetError(MS_MISCERR, "Don't know how to draw class %s of layer %s without a style definition.", "msDrawQueryLayer()", layer->class[i]->name, layer->name); msFree(colorbuffer); @@ -1521,7 +1521,7 @@ int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image) /* if MS_HILITE, restore color and mindistance values */ if(map->querymap.style == MS_HILITE) { for(i=0; inumclasses; i++) { - if(layer->type == MS_LAYER_POLYGON) { + if(layer->type == MS_LAYER_POLYGON && layer->class[i]->numstyles > 0) { if(MS_VALID_COLOR(layer->class[i]->styles[0]->color)) layer->class[i]->styles[0]->color = colorbuffer[i]; else if(MS_VALID_COLOR(layer->class[i]->styles[0]->outlinecolor))