Skip to content

Commit 38dce08

Browse files
authored
Merge pull request #276 from startewho/master
fix the empty cell value edit crash
2 parents b0dd676 + 6c1d9a7 commit 38dce08

File tree

1 file changed

+10
-1
lines changed
  • src/Avalonia.Controls.TreeDataGrid/Models/TreeDataGrid

1 file changed

+10
-1
lines changed

src/Avalonia.Controls.TreeDataGrid/Models/TreeDataGrid/TextCell.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,16 @@ public TextCell(
4949
public string? Text
5050
{
5151
get => _value?.ToString();
52-
set => Value = (T?)Convert.ChangeType(value, typeof(T));
52+
set{
53+
if (string.IsNullOrEmpty(value))
54+
{
55+
Value = default(T?);
56+
}
57+
else
58+
{
59+
Value = (T?)Convert.ChangeType(value, typeof(T));
60+
}
61+
}
5362
}
5463

5564
public T? Value

0 commit comments

Comments
 (0)