Skip to content

Commit

Permalink
gui: Disallow creating zero sized nets
Browse files Browse the repository at this point in the history
When creating bus rippers in 'net' style with zero-sized bus
ripper setting enabled in the previous commit, zero sized nets
were created as well.  This has been fixed by disabling creation
of zero sized net objects in such situations.
  • Loading branch information
vzh committed Feb 29, 2024
1 parent db8c4b6 commit 2dc77c9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libleptongui/src/o_net.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Lepton EDA Schematic Capture
* Copyright (C) 1998-2010 Ales Hvezda
* Copyright (C) 1998-2016 gEDA Contributors
* Copyright (C) 2017-2022 Lepton EDA Contributors
* Copyright (C) 2017-2024 Lepton EDA Contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1057,7 +1057,12 @@ int o_net_add_busrippers(GschemToplevel *w_current, LeptonObject *net_obj,
}

for (i = 0; i < ripper_count; i++) {
if (w_current->bus_ripper_type == NET_BUS_RIPPER) {
if ((w_current->bus_ripper_type == NET_BUS_RIPPER) &&
/* Don't add a new net if the coords are the same.
* Otherwise it will be zero sized. */
! ((rippers[i].x[0] == rippers[i].x[1]) &&
(rippers[i].y[0] == rippers[i].y[1])))
{
new_obj = lepton_net_object_new (NET_COLOR,
rippers[i].x[0],
rippers[i].y[0],
Expand Down

0 comments on commit 2dc77c9

Please sign in to comment.