supertux icon indicating copy to clipboard operation
supertux copied to clipboard

Loading Level with old Unstable Tile sprite crashes game

Open Lolkat76 opened this issue 3 years ago • 2 comments

SuperTux version: 0.6.3 new tileset PR (https://github.com/SuperTux/supertux/pull/2136) System information: Windows 10, x64

Expected behavior

The game doesn't crash when trying to load the invalid sprite. Not much of an issue for anyone not updating levels.

Actual behavior

The game crashes trying to load the invalid sprite, since unstable_tile.sprite was renamed to brick.sprite in this pr

Steps to reproduce actual behavior

Load a level with the old unstable tile sprite in use, and the game will crash. Only bumped into updating my own levels, but as they are used elsewhere, might save a little bit of headache for someone. I've attached a level that will cause the issue from my set, for ease of reproduction, or you can just stick this in any level to see: (unstable_tile (sprite "images/objects/unstable_tile/unstable_tile.sprite") (x 6688) (y 416) )

Additional debugging information

Fatal error is: [FATAL] D:\a\supertux\supertux\src\supertux\main.cpp:701 Unexpected exception: Parse error when trying to load sprite 'images/objects/unstable_tile/unstable_tile.sprite': Couldn't open file 'images/objects/unstable_tile/unstable_tile.sprite': not found Removing any instances of unstable tiles in a level using this sprite resolves the issue and allows it to be opened again.

Example.zip

Lolkat76 avatar Jul 16 '22 20:07 Lolkat76

This happens most likely because the old sprite file the object used is no longer avialable.

Perhaps a future proof way of fixing this is to mark one of the persisting unstable tiles (e.g. images/objects/unstable_tile/snow.sprite) as the default sprite and tell the object to always revert to that when a missing sprite is in use instead.

@mrkubax10 Is this something we'd be able to do. For objects in general this could avoid many potential crashes I believe.

Rusty-Box avatar Jul 25 '22 14:07 Rusty-Box

Perhaps a future proof way of fixing this is to mark one of the persisting unstable tiles (e.g. images/objects/unstable_tile/snow.sprite) as the default sprite and tell the object to always revert to that when a missing sprite is in use instead.

Should be possible to do. Easier solution is to use generic missing image graphic.

mrkubax10 avatar Jul 25 '22 15:07 mrkubax10