Skip to content

Commit

Permalink
Changes following PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mansellan committed Apr 20, 2018
1 parent 8ac6a5f commit 4fd24a6
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions Rubberduck.VBEditor.VB6/SafeComWrappers/VB/VBControl.cs
Expand Up @@ -22,22 +22,20 @@ public string Name
{
return string.Empty;
}

using (var properties = this.Properties)
try
{
foreach (var property in properties)
using (var properties = this.Properties)
using (var property = properties["Name"])
{
using (property)
{
if (property.Name == "Name")
{
return (string)property.Value;
}
}
return property.Value as string;
}
}
// Should never happen - all VB controls are required to be named.
return null;
catch (Exception exception)
{
// Assumption - all VB controls are required to be named.
System.Diagnostics.Debug.Assert(false, "VBControl.get_Name failed.", $"{exception}");
}
return string.Empty;
}
set
{
Expand All @@ -57,7 +55,8 @@ public string Name
}
}
}
// Should never happen - all VB controls are required to be named.
// All VB controls are required to be named.
System.Diagnostics.Debug.Assert(false, "VBControl.set_Name failed: Name property not found.");
}
}
}
Expand Down

0 comments on commit 4fd24a6

Please sign in to comment.