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

Bugfix: index out of bounds when clicking the green or yellow symbol … #694

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

steran82
Copy link
Contributor

@steran82 steran82 commented Mar 9, 2025

Bugfix: when opening a field and clicking one of the 2 mark-buttons (green or yellow) before you have selected a track an error occured in Sections.Designer.cs Method markAsWorkedTrack() - its about the new feature which allows skipping already worked tracks at youturn.

replacement for PR: #689

@steran82
Copy link
Contributor Author

steran82 commented Mar 9, 2025

I noticed the comment that the check for List (workedTracks.Contains isn' ideal for doubles; but i dont have an idea how to improve this.
Is this really a problem, when it comes from the same source (howManyPathsAway) and it is compared with this?
I thought about changing it to an integer - but then we will eventually run into an overflow when track/field is still active and losing gps or getting illegal gps coordinates...

i tried to refactore too, to avoid duplicate code...

@FantasyTeddy
Copy link
Collaborator

Regarding the double issue:
I added two commits to your branch:

  1. Use int instead of double for workedTracks. I don't quite understand how this should lead to some kind of overflow. Could you explain that?
  2. Use a HashSet to store the workedTracks, because the previously used List is actually being treated like a hash set.

@J005t67: What do you think?

@steran82
Copy link
Contributor Author

steran82 commented Mar 11, 2025

Regarding the double issue: I added two commits to your branch:

1. Use `int` instead of `double` for `workedTracks`. I don't quite understand how this should lead to some kind of overflow. Could you explain that?

I thought about it again and also played with the debugger.
I don't think it can occur. If I manipulate the values in the debugger as much as it should not be in reality, I get a different error message:

Serious Field Origin Error

Field Origin is More Then 20 km from your current GPS
Position Delete this field and create a new one as
Accuracy will be poor

Or you may have a field open and drove far away

So in my humble opinion integer should be enough.

Translated with DeepL.com (free version)

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.

2 participants