Skip to content

Commit

Permalink
Fixed null being unable to be set as an item
Browse files Browse the repository at this point in the history
Fixes #131
  • Loading branch information
justalemon committed Oct 25, 2023
1 parent a11a808 commit 6fd9ace
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LemonUI/Menus/NativeDynamicItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void UpdateItemName()
{
// This is the SAME as the normal NativeListItem

text.Text = !SelectedItem.Equals(default) ? SelectedItem.ToString() : string.Empty;
text.Text = SelectedItem == null ? string.Empty : SelectedItem.ToString();

text.Position = new PointF(RightArrow.Position.X - text.Width + 3, text.Position.Y);
LeftArrow.Position = new PointF(text.Position.X - LeftArrow.Size.Width, LeftArrow.Position.Y);
Expand Down
4 changes: 2 additions & 2 deletions LemonUI/Menus/NativeListItem{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void FixIndexIfRequired()
/// </summary>
private void UpdateIndex()
{
text.Text = SelectedIndex != -1 ? SelectedItem.ToString() : string.Empty;
text.Text = SelectedItem == null ? string.Empty : SelectedItem.ToString();

text.Position = new PointF(RightArrow.Position.X - text.Width + 3, text.Position.Y);
LeftArrow.Position = new PointF(text.Position.X - LeftArrow.Size.Width, LeftArrow.Position.Y);
Expand Down Expand Up @@ -346,4 +346,4 @@ public override void UpdateColors()

#endregion
}
}
}

0 comments on commit 6fd9ace

Please sign in to comment.