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 map with invalid version crashes editor #1100

Merged
merged 1 commit into from Jun 1, 2013

Conversation

minus7
Copy link
Member

@minus7 minus7 commented May 26, 2013

CEditorMap::Load returned true in some cases even if the map failed to load. CEditor::CallbackOpenMap didn't reset in case of a failed load.

In particular the editor checks MAPITEMTYPE_VERSION in the datafile to be 1 but just continues if it isn't (or if this item isn't even in the file) whereas the game itself doesn't use this item at all. It seems to have been used to distinguish the current map format from an older one (see CEditorMap::Load, game/editor/io.cpp:420)

This patch just gets rid of the crash (the map loading dialog will just stay open). It might be better to get rid of this version item along with the (mostly commented out) legacy code.

The patch is based on the 0.6 branch but the same problem exists in the development branch too.

@heinrich5991
Copy link
Contributor

Maybe it should be checked in the game too! Otherwise people will just keep setting this field.

@minus7
Copy link
Member Author

minus7 commented May 28, 2013

That's one option. Another option would be to change the data format version each time the map format changes. Since changing the map format implies a minor version change anyway this is possible. Checking the map version in the game too might be the saner idea though.

oy added a commit that referenced this pull request Jun 1, 2013
Loading map with invalid version crashes editor
@oy oy merged commit 8faf175 into teeworlds:0.6 Jun 1, 2013
@minus7 minus7 deleted the mapversion-editor-crash branch June 1, 2013 13:26
ChillerDragon pushed a commit to ChillerDragon/ddnet that referenced this pull request Aug 6, 2020
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.

None yet

3 participants