Index: obj_poly.h =================================================================== --- obj_poly.h (revision 12451) +++ obj_poly.h (revision 12452) @@ -201,11 +201,13 @@ /* Let the poly clear sorrunding polys in its layer */ #define pcb_poly_ppclear(poly) \ do { \ - pcb_layer_t *layer = pcb_layer_get_real(poly->parent.layer); \ - if ((layer != NULL) && (layer->parent->parent_type == PCB_PARENT_BOARD)) { \ - if (layer->is_bound) layer = layer->meta.bound.real; \ - if (PCB_POLY_HAS_CLEARANCE(poly) && (layer != NULL)) \ - pcb_poly_clear_from_poly(layer->parent, PCB_TYPE_POLYGON, layer, poly); \ + if (poly->parent.layer != NULL) { \ + pcb_layer_t *layer = pcb_layer_get_real(poly->parent.layer); \ + if ((layer != NULL) && (layer->parent->parent_type == PCB_PARENT_BOARD)) { \ + if (layer->is_bound) layer = layer->meta.bound.real; \ + if (PCB_POLY_HAS_CLEARANCE(poly) && (layer != NULL)) \ + pcb_poly_clear_from_poly(layer->parent, PCB_TYPE_POLYGON, layer, poly); \ + } \ } \ } while(0) @@ -212,11 +214,13 @@ /* Let the poly restore sorrunding polys in its layer */ #define pcb_poly_pprestore(poly) \ do { \ - pcb_layer_t *layer = pcb_layer_get_real(poly->parent.layer); \ - if ((layer != NULL) && (layer->parent->parent_type == PCB_PARENT_BOARD)) { \ - if (layer->is_bound) layer = layer->meta.bound.real; \ - if (PCB_POLY_HAS_CLEARANCE(poly) && (layer != NULL)) \ - pcb_poly_restore_to_poly(layer->parent, PCB_TYPE_POLYGON, layer, poly); \ + if (poly->parent.layer != NULL) { \ + pcb_layer_t *layer = pcb_layer_get_real(poly->parent.layer); \ + if ((layer != NULL) && (layer->parent->parent_type == PCB_PARENT_BOARD)) { \ + if (layer->is_bound) layer = layer->meta.bound.real; \ + if (PCB_POLY_HAS_CLEARANCE(poly) && (layer != NULL)) \ + pcb_poly_restore_to_poly(layer->parent, PCB_TYPE_POLYGON, layer, poly); \ + } \ } \ } while(0)