Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash when open target context menu #2618

Merged
merged 2 commits into from
Feb 23, 2025

Conversation

WeylonSantana
Copy link
Contributor

resolves #2610

Comment on lines 158 to 168
if (_entity is Player player && player != _me && string.IsNullOrWhiteSpace(player.Guild))
{
if (_me?.GuildRank?.Permissions?.Invite ?? false)
{
Insert(0, _targetNameMenuItem);
AddChild(_guildMenuItem);
}
}
else

if (_entity is Player plyr && plyr != _me)
{
Remove(_targetNameMenuItem);
AddChild(_privateMessageMenuItem);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_entity shouldn't be checked if it's a player twice

@@ -134,27 +139,33 @@ public void ToggleHidden(object? target)
}
}

private void TryShowTargetButton(bool shouldShow)
private void _buildContextMenu(bool shouldShowTargetName = false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call it BuildContextMenu

_nameDivider = new MenuDivider(this)
{
Dock = Pos.Top,
Margin = new Margin(IconMarginDisabled ? 0 : 24, 0, 4, 0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does a divider have a margin?

{
Dock = Pos.Top,
Margin = new Margin(IconMarginDisabled ? 0 : 24, 0, 4, 0),
Height = 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary when MinimumSize will already control this

@lodicolo lodicolo merged commit dc95f5d into AscensionGameDev:main Feb 23, 2025
1 check passed
@WeylonSantana WeylonSantana deleted the fix-2610 branch February 23, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Crash when trying to open targetbox combobox
2 participants