From 7ce4357fbe3cc14e598a54952d9385cf5c85d8c2 Mon Sep 17 00:00:00 2001 From: facat Date: Sun, 31 May 2020 08:20:39 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=A7=BB=E9=99=A4=E4=B8=80=E4=B8=AAbug?= =?UTF-8?q?=E3=80=82=202.=E5=88=A0=E9=99=A4=E6=9C=80=E5=90=8E=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E7=9A=84=E5=A1=94=E4=BD=8D=EF=BC=8C=E5=B9=B6=E6=94=BE?= =?UTF-8?q?=E7=BD=AE=E6=96=B0=E7=9A=84=E5=A1=94=E4=BD=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: facat --- PutTowerPosition/cmd.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/PutTowerPosition/cmd.cs b/PutTowerPosition/cmd.cs index da3db12..61dc2f2 100644 --- a/PutTowerPosition/cmd.cs +++ b/PutTowerPosition/cmd.cs @@ -93,8 +93,15 @@ namespace PutTowerPosition { DBText latestTowerName = acTrans.GetObject(tower.name, OpenMode.ForWrite) as DBText; DBPoint latestTowerPoint = acTrans.GetObject(tower.point, OpenMode.ForWrite) as DBPoint; - latestTowerName.Erase(); - latestTowerPoint.Erase(); + if (latestTowerName != null) + { + latestTowerName.Erase(); + } + if (latestTowerPoint != null) + { + latestTowerPoint.Erase(); + } + } latestTowerList.Clear(); @@ -308,7 +315,10 @@ namespace PutTowerPosition } string norm_line; norm_line = Regex.Replace(line, @"\s+", ","); - norm_line = norm_line.Substring(1); + if (norm_line.StartsWith(",")) + { + norm_line = norm_line.Substring(1); + } string[] sep = norm_line.Split(','); string towerName = sep[0]; if (has_tower.ContainsKey(towerName))