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

Clicking newly invented vehicle in news throws out of range exception #498

Closed
AaronVanGeffen opened this issue May 29, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@AaronVanGeffen
Copy link
Member

OS: Arch Linux
Version: 20.05+
Commit/Build: 690b0c4

Clicking a newly invented vehicle in the news throws an out of range exception.

Steps to reproduce:
In the attached save…

  1. Speed up till January
  2. Click the newly invented airplane

Is the issue reproducible in Locomotion (vanilla)?
No

Save game:
Desert Delirium Aaron 9.SV5.zip

Backtrace:

* thread #1, name = 'openloco', stop reason = signal SIGABRT
    frame #0: 0xf7fd0ed9 [vdso]`__kernel_vsyscall + 9
[vdso]`__kernel_vsyscall:
->  0xf7fd0ed9 <+9>:  popl   %ebp
    0xf7fd0eda <+10>: popl   %edx
    0xf7fd0edb <+11>: popl   %ecx
    0xf7fd0edc <+12>: retl   
(lldb) bt
* thread #1, name = 'openloco', stop reason = signal SIGABRT
  * frame #0: 0xf7fd0ed9 [vdso]`__kernel_vsyscall + 9
    frame #1: 0xf7912e76 libc.so.6`raise + 198
    frame #2: 0xf78fb3f2 libc.so.6`abort + 301
    frame #3: 0xf7c2a980 libstdc++.so.6`__gnu_cxx::__verbose_terminate_handler() (.cold) at vterminate.cc:95:10
    frame #4: 0xf7c387c7 libstdc++.so.6`__cxxabiv1::__terminate(void (*)()) at eh_terminate.cc:48:15
    frame #5: 0xf7c38853 libstdc++.so.6`std::terminate() at eh_terminate.cc:58:15
    frame #6: 0xf7c38bb5 libstdc++.so.6`__cxxabiv1::__cxa_throw(obj=0x0159b940, tinfo=0xf7d7dfb4, dest=(libstdc++.so.6`std::out_of_range::~out_of_range() at stdexcept.cc:65:3))(void *)) at eh_throw.cc:95:18
    frame #7: 0x01201030 openloco`openloco::interop::loco_global<signed char [8], 18048240u>::operator[](this="\xfffffff0d\x13\x01\xfffffff8d\x13\x01\xffffffe8h\xffffff9c", idx=303) at interop.hpp:311:17
    frame #8: 0x011faf7c openloco`openloco::ui::build_vehicle::sub_4B92A5(window=0x011392e4) at build_vehicle.cpp:553:76
    frame #9: 0x011fa790 openloco`operator(__closure=0x00000000, regs=0x012fef98) at build_vehicle.cpp:378:27
    frame #10: 0x011fa7f4 openloco`_FUN((null)=0x012fef98) at build_vehicle.cpp:381:13
@AaronVanGeffen AaronVanGeffen added the bug Something isn't working label May 29, 2020
@AaronVanGeffen
Copy link
Member Author

The problem tracks down to:

        uint8_t trackType = _TrackTypesForTab[window->current_secondary_tab];

window::current_secondary_tab is not initialised to zero when constructing or opening the window — only when clicking a primary tab. I think the issue would be fixed by zeroing it on construction.

AaronVanGeffen added a commit to AaronVanGeffen/OpenLoco that referenced this issue May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant