Index: obj_poly.h =================================================================== --- obj_poly.h (revision 7775) +++ obj_poly.h (revision 7776) @@ -89,7 +89,7 @@ #define PCB_POLY_ALL_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ PCB_POLY_LOOP(layer) @@ -96,7 +96,7 @@ #define PCB_POLY_COPPER_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (!(pcb_layer_flags(l) & PCB_LYT_COPPER)) continue; \ PCB_POLY_LOOP(layer) @@ -104,7 +104,7 @@ #define PCB_POLY_SILK_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (!(pcb_layer_flags(l) & PCB_LYT_SILK)) continue; \ PCB_POLY_LOOP(layer) @@ -112,7 +112,7 @@ #define PCB_POLY_VISIBLE_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (layer->On) \ PCB_POLY_LOOP(layer)