Skip to content

Commit

Permalink
Merge pull request #3 from allisonchou/AddParameterOptionalDavid
Browse files Browse the repository at this point in the history
Fix crash bug when entering name before type and clicking OK
  • Loading branch information
David Poeschl committed Feb 13, 2020
2 parents f065ad3 + 482738a commit 548c943
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public AddParameterDialogViewModel(Document document, int insertPosition)

public ITypeSymbol? TypeSymbol { get; set; }

public string TypeName
public string? TypeName
{
get
{
return TypeSymbol!.ToDisplayString(_symbolDisplayFormat);
return TypeSymbol?.ToDisplayString(_symbolDisplayFormat);
}
}

Expand All @@ -67,13 +67,13 @@ internal void UpdateTypeSymbol(string typeName)

internal bool TrySubmit(Document document)
{
if (string.IsNullOrEmpty(ParameterName) || string.IsNullOrEmpty(TypeName))
if (string.IsNullOrEmpty(TypeName) || string.IsNullOrEmpty(ParameterName))
{
SendFailureNotification(ServicesVSResources.A_type_and_name_must_be_provided);
return false;
}

if (!IsParameterTypeValid(TypeName, document))
if (!IsParameterTypeValid(TypeName!, document))
{
SendFailureNotification(ServicesVSResources.Parameter_type_contains_invalid_characters);
return false;
Expand Down

0 comments on commit 548c943

Please sign in to comment.