From 2dc77c9ed8762e8e6230675c71c6dd3eebfce475 Mon Sep 17 00:00:00 2001 From: Vladimir Zhbanov Date: Thu, 8 Feb 2024 18:20:18 +0300 Subject: [PATCH] gui: Disallow creating zero sized nets 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. --- libleptongui/src/o_net.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libleptongui/src/o_net.c b/libleptongui/src/o_net.c index d98417457b..b764b4191d 100644 --- a/libleptongui/src/o_net.c +++ b/libleptongui/src/o_net.c @@ -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 @@ -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],