Index: obj_arc.c =================================================================== --- obj_arc.c (revision 28843) +++ obj_arc.c (revision 28844) @@ -404,8 +404,14 @@ pcb_layer_t *srcly = arc->parent.layer; assert(arc->parent_type == PCB_PARENT_LAYER); - if ((dstly == NULL) || (dstly == srcly)) /* auto layer in dst */ - dstly = &ctx->buffer.dst->Layer[pcb_layer_id(ctx->buffer.src, srcly)]; + if ((dstly == NULL) || (dstly == srcly)) { /* auto layer in dst */ + pcb_layer_id_t lid = pcb_layer_id(ctx->buffer.src, srcly); + if (lid < 0) { + pcb_message(PCB_MSG_ERROR, "Internal error: can't resolve source layer ID in pcb_arcop_move_buffer\n"); + return NULL; + } + dstly = &ctx->buffer.dst->Layer[lid]; + } pcb_poly_restore_to_poly(ctx->buffer.src, PCB_OBJ_ARC, srcly, arc); pcb_r_delete_entry(srcly->arc_tree, (pcb_box_t *) arc);