-
Notifications
You must be signed in to change notification settings - Fork 366
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
Conversation
f5db86e
to
cabb5f3
Compare
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); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
resolves #2610