Skip to content

Commit

Permalink
fix: handle empty string/hyperlinq interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
rdavisau committed Apr 27, 2019
1 parent 758b61a commit 6a3e930
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/DumpEditable/EditorRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,13 @@ public static EditorRule ForTypeWithStringBasedEditor<T>(ParseFunc<string, T, bo
? NullString
: (isEnumerable ? JsonConvert.SerializeObject(currVal) : $"{currVal}");

// hyperlinq doesn't like empty strings
if (desc == String.Empty)
desc = EmptyString;

var change = new Hyperlinq(() =>
{
var newVal = Interaction.InputBox("Set value for " + p.Name, p.Name, desc);
var newVal = Interaction.InputBox("Set value for " + p.Name, p.Name, desc != EmptyString ? desc : String.Empty);
var canConvert = parseFunc(newVal, out var output);
if (isEnumerable)
Expand Down Expand Up @@ -136,5 +140,6 @@ public static EditorRule ForTypeWithStringBasedEditor<T>(ParseFunc<string, T, bo
public delegate V ParseFunc<T, U, V>(T input, out U output);

private const string NullString = "(null)";
private const string EmptyString = "(empty string)";
}
}

0 comments on commit 6a3e930

Please sign in to comment.