Skip to content

Commit

Permalink
Merge pull request #2116 from cwensley/curtis/fix-gridview-crash-with…
Browse files Browse the repository at this point in the history
…-blank-values

Mac: Fix crash when there are null values for TextBoxCell or ImageTextCell
  • Loading branch information
cwensley authored Jan 17, 2022
2 parents fd3b7a5 + 401e81a commit a83127a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Eto.Mac/Forms/Cells/ImageTextCellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public NSObject ObjectValue
{
var val = value as MacImageData;

TextField.ObjectValue = val?.Text ?? NSString.Empty;
TextField.ObjectValue = (NSString)(val?.Text ?? string.Empty);
Image = val?.Image;
_objectValue = value;
}
Expand Down
5 changes: 3 additions & 2 deletions src/Eto.Mac/Forms/Cells/TextBoxCellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ public override NSObject GetObjectValue(object dataItem)
if (Widget.Binding != null)
{
var val = Widget.Binding.GetValue(dataItem);
return val != null ? new NSString(Convert.ToString(val)) : NSString.Empty;
var ret = val != null ? Convert.ToString(val) : string.Empty;
return (NSString)ret;
}
return NSString.Empty;
return (NSString)string.Empty;
}

public override void SetObjectValue(object dataItem, NSObject value)
Expand Down

0 comments on commit a83127a

Please sign in to comment.