diff --git a/Robot_Adapter/CRUD/Create/Elements/Bars.cs b/Robot_Adapter/CRUD/Create/Elements/Bars.cs index 79e15574..5b2e3697 100644 --- a/Robot_Adapter/CRUD/Create/Elements/Bars.cs +++ b/Robot_Adapter/CRUD/Create/Elements/Bars.cs @@ -80,7 +80,7 @@ private bool CreateCollection(IEnumerable bhomBars) materialName, orientationAngle); - if (bhomBar.Name != null || bhomBar.Name != "") + if (!string.IsNullOrWhiteSpace(bhomBar.Name)) rcache.SetBarName(barNum, bhomBar.Name); if (bhomBar.Release != null) diff --git a/Robot_Adapter/CRUD/Update/Elements/Bars.cs b/Robot_Adapter/CRUD/Update/Elements/Bars.cs index 30290432..a278b73a 100644 --- a/Robot_Adapter/CRUD/Update/Elements/Bars.cs +++ b/Robot_Adapter/CRUD/Update/Elements/Bars.cs @@ -64,7 +64,7 @@ protected bool Update(IEnumerable bars) robotBar.EndNode = System.Convert.ToInt32(bar.EndNode.CustomData[AdapterIdName]); barTags[System.Convert.ToInt32(bar.CustomData[AdapterIdName])] = bar.Tags; - if (bar.Name != null || bar.Name != "") + if (!string.IsNullOrWhiteSpace(bar.Name)) robotBar.NameTemplate = bar.Name; if (bar.SectionProperty != null && !string.IsNullOrWhiteSpace(bar.SectionProperty.Name)) diff --git a/Robot_Adapter/Convert/FromRobot/Elements/Bar.cs b/Robot_Adapter/Convert/FromRobot/Elements/Bar.cs index a8e836fe..7ac5608d 100644 --- a/Robot_Adapter/Convert/FromRobot/Elements/Bar.cs +++ b/Robot_Adapter/Convert/FromRobot/Elements/Bar.cs @@ -147,7 +147,7 @@ public static Bar FromRobot( this RobotBar robotBar, BH.Engine.Reflection.Compute.RecordEvent("Bars with auto-generated releases will not have releases", oM.Reflection.Debugging.EventType.Warning); } - if (robotBar.Name != null || robotBar.Name != "") + if (!string.IsNullOrWhiteSpace(robotBar.Name)) bhomBar.Name = robotBar.Name; bhomBar.SectionProperty = secProp;