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

Loading a save from 1.7.2 crashes on 1.10.0-beta2 #7891

Closed
SamuXarick opened this issue Jan 2, 2020 · 3 comments
Closed

Loading a save from 1.7.2 crashes on 1.10.0-beta2 #7891

SamuXarick opened this issue Jan 2, 2020 · 3 comments
Labels
bug Something isn't working regression It used to work, and now it's broken.

Comments

@SamuXarick
Copy link
Contributor

Version of OpenTTD

1.10.0-beta2

Expected result

Not crash

Actual result

Crash

Steps to reproduce

Load savegame
NoNoCAB v5 (Y), 1.7.2.zip

crash.zip

@LordAro
Copy link
Member

LordAro commented Jan 2, 2020

#0  0x00007ffff5565f25 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff554f897 in abort () from /usr/lib/libc.so.6
#2  0x00007ffff554f767 in __assert_fail_base.cold () from /usr/lib/libc.so.6
#3  0x00007ffff555e526 in __assert_fail () from /usr/lib/libc.so.6
#4  0x0000555555a5a28a in SpecializedVehicle<RoadVehicle, (VehicleType)1>::From (v=v@entry=0x55555814e1a0) at /home/lordaro/dev/openttd/src/vehicle_base.h:1110
#5  0x0000555555cdb578 in CanBuildVehicleInfrastructure (type=type@entry=VEH_ROAD, subtype=subtype@entry=0 '\000') at /home/lordaro/dev/openttd/src/vehicle.cpp:1777
#6  0x0000555555ca5424 in MainToolbarWindow::OnPaint (this=0x555558ad8310) at /home/lordaro/dev/openttd/src/toolbar_gui.cpp:2069
#7  0x0000555555d12411 in DrawOverlappedWindowForAll (left=left@entry=0, top=top@entry=0, right=right@entry=956, bottom=bottom@entry=511) at /home/lordaro/dev/openttd/src/window.cpp:974
#8  0x0000555555a41848 in RedrawScreenRect (left=0, top=0, right=956, bottom=511) at /home/lordaro/dev/openttd/src/gfx.cpp:1294
#9  0x0000555555a420b2 in DrawDirtyBlocks () at /home/lordaro/dev/openttd/src/gfx.cpp:1390
#10 0x0000555555d1680f in UpdateWindows () at /home/lordaro/dev/openttd/src/window.cpp:3199
#11 0x0000555555cf1220 in VideoDriver_SDL::MainLoop (this=0x555557288540) at /home/lordaro/dev/openttd/src/video/sdl2_v.cpp:764
#12 0x0000555555b4ed0d in openttd_main (argc=<optimized out>, argv=<optimized out>) at /home/lordaro/dev/openttd/src/openttd.cpp:858
#13 0x00007ffff5551153 in __libc_start_main () from /usr/lib/libc.so.6
#14 0x000055555592001e in _start () at /home/lordaro/dev/openttd/src/effectvehicle.cpp:664

(gdb) p v->type
$4 = VEH_COMPANY_END
(gdb) p (int)v->type
$5 = 4

Seems like some bad saveload code somewhere.

...not sure why gdb thinks _start is in effectvehicle.cpp. Can be ignored.

@LordAro LordAro added bug Something isn't working regression It used to work, and now it's broken. labels Jan 2, 2020
@LordAro
Copy link
Member

LordAro commented Jan 2, 2020

OpenTTD/src/vehicle.cpp

Lines 1786 to 1790 in 3a557b0

/* We should be able to build infrastructure when we have the actual vehicle type */
for (const Vehicle *v : Vehicle::Iterate()) {
if (type == VEH_ROAD && GetRoadTramType(RoadVehicle::From(v)->roadtype) != (RoadTramType)subtype) continue;
if (v->owner == _local_company && v->type == type) return true;
}

is the particular block at fault - This is called with all vehicles, not just with road vehicles. Added as part of NRT. Not clear if type should be v->type. There's a similar block just above

@michicc
Copy link
Member

michicc commented Jan 2, 2020

I'd be quite astonished if it shouldn't have been v->type to begin with. Doesn't really fit otherwise.

SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Jan 2, 2020
@LordAro LordAro closed this as completed in 9e7c523 Jan 3, 2020
douiwby pushed a commit to douiwby/OpenTTD that referenced this issue Apr 16, 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 regression It used to work, and now it's broken.
Projects
None yet
Development

No branches or pull requests

3 participants