[wesnoth-commits] [wesnoth/wesnoth] 7d04b8: Error handling for corrupt .mo files (#6214)

Steve Cotton noreply at github.com
Thu Oct 21 18:27:14 UTC 2021


  Branch: refs/heads/1.16
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 7d04b8038528cec384040520aead04fd755cb560
      https://github.com/wesnoth/wesnoth/commit/7d04b8038528cec384040520aead04fd755cb560
  Author: Steve Cotton <steve at octalot.co.uk>
  Date:   2021-10-21 (Thu, 21 Oct 2021)

  Changed paths:
    M changelog.md
    M src/gettext.cpp

  Log Message:
  -----------
  Error handling for corrupt .mo files (#6214)

Previously, a corrupt .mo file caused the game to exit immediately. This meant
that a broken add-on could stop the user from reaching the main menu, a
situation that could only be recovered by editing the preferences file or by
deleting the add-on with a file browser.

The engine generates the locale 3 times:
* once with no .mo files loaded
* once with only the mainline .mo files loaded
* once with all .mo files loaded

This means that:
* starting Wesnoth with a corrupt .mo file in mainline will make the engine run
  showing en_US text
* changing language with a corrupt .mo file in mainline will make the engine
  stay in whatever language it had successfully loaded
* a corrupt .mo file in an add-on will disable .mo files in all add-ons, but
  leave mainline translations active, and will let the user play the game





More information about the Commits mailing list