-
-
Notifications
You must be signed in to change notification settings - Fork 968
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 #8922: Show vehicle window for single vehicle in shared order grouping #8926
Conversation
Does this fix the issue? If a shared group window is opened, then the list size is reduced from 2+ to none, it will still crash, no? |
Hmm, I'll check that later tonight. However, if this was the case, then this bug would have been in OpenTTD for much longer than my PR for grouping by shared orders (and hence surprising that it was only discovered now). |
I've just tested and it no longer crashes: In the linked savegame, I bought a new vehicle and cloned the orders of vehicle 289 to it, then sold all vehicles in the depot (i.e. both of them). The shared orders window disappears as expected; no crashes. I believe the code that deletes the shared order window when there is only one vehicle left is this: Lines 2790 to 2793 in 799eb31
Presumably selling all vehicles in the depot will delete vehicles one-by-one, which is probably why it works. |
8cc6a32
to
087ab7c
Compare
Reworded the commit message to conform to the style guide. |
src/group_gui.cpp
Outdated
} | ||
else { |
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.
Oh wait, codestyle - this and below should be on one line
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.
Fixed.
087ab7c
to
6a44914
Compare
Motivation / Problem
Fixes #8922 - shared order list could have only one vehicle, which leads to a crash later when that vehicle is deleted.
Description
When viewing by shared order groups, if a vehicle is not shared, don't open the shared order list (of just a single vehicle). Instead, open the vehicle window.
Limitations
None
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.