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

Found strange code in source code #390

Open
liufeias opened this issue Dec 25, 2024 · 1 comment
Open

Found strange code in source code #390

liufeias opened this issue Dec 25, 2024 · 1 comment

Comments

@liufeias
Copy link

Found strange code
if (position > HexPosition.MaxEndPosition) has already judged a case greater than HexPosition.MaxEndPosition, and then if (position >= HexPosition.MaxEndPosition) has judged again

if (position > HexPosition.MaxEndPosition)
throw new ArgumentOutOfRangeException(nameof(position));
if (hexView.IsClosed)
return null;
if (position >= HexPosition.MaxEndPosition)
return null;

@Guiorgy
Copy link

Guiorgy commented Dec 26, 2024

So the last statement is equivalent to position == HexPosition.MaxEndPosition. Though it's not really a problem. One could argue that saying "anything above, and including, max position is invalid" is more expressive.

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

No branches or pull requests

2 participants