Index: xy.c =================================================================== --- xy.c (revision 34027) +++ xy.c (revision 34028) @@ -813,7 +813,7 @@ pcb_cam_begin_nolayer(PCB, &cam, NULL, options[HA_cam].str, &xy_filename); - if (options[HA_unit].lng == -1) + if ((options[HA_unit].lng < 0) || (options[HA_unit].lng >= rnd_get_n_units(1))) xy_unit = rnd_get_unit_struct("mil"); else xy_unit = &rnd_units[options[HA_unit].lng];