Skip to content

Commit

Permalink
Simplify string null empty check
Browse files Browse the repository at this point in the history
  • Loading branch information
rwemay committed Jun 10, 2020
1 parent a831a35 commit fa9cf96
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Robot_Adapter/CRUD/Create/Elements/Bars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private bool CreateCollection(IEnumerable<Bar> bhomBars)
materialName,
orientationAngle);

if (bhomBar.Name != null || bhomBar.Name != "")
if (!string.IsNullOrWhiteSpace(bhomBar.Name))
rcache.SetBarName(barNum, bhomBar.Name);

if (bhomBar.Release != null)
Expand Down
2 changes: 1 addition & 1 deletion Robot_Adapter/CRUD/Update/Elements/Bars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected bool Update(IEnumerable<Bar> 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))
Expand Down
2 changes: 1 addition & 1 deletion Robot_Adapter/Convert/FromRobot/Elements/Bar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fa9cf96

Please sign in to comment.