diff options
author | rubidium <rubidium@openttd.org> | 2008-03-26 11:50:53 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-03-26 11:50:53 +0000 |
commit | 8989e6572f53e7dbd1974f6b8d261f41cad0efcc (patch) | |
tree | 04dec6e0f8d968041a6e0fcf06340fec448fdbfd /src/osk_gui.cpp | |
parent | a28f2f2bb17eed47eb0d572c49267418e731b45d (diff) | |
download | openttd-8989e6572f53e7dbd1974f6b8d261f41cad0efcc.tar.xz |
(svn r12428) -Fix [FS#1878]: loading from the config file could fail even when the data is correct. Patch by Dominik.
Diffstat (limited to 'src/osk_gui.cpp')
-rw-r--r-- | src/osk_gui.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 42ff5b5bf..80a87edd5 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -299,14 +299,22 @@ void GetKeyboardLayout() if (StrEmpty(_keyboard_opt[1])) { GetString(keyboard[1], STR_OSK_KEYBOARD_LAYOUT_CAPS, lastof(keyboard[1])); } else { - strncpy(keyboard[0], _keyboard_opt[0], lengthof(keyboard[1])); + strncpy(keyboard[1], _keyboard_opt[1], lengthof(keyboard[1])); } for (uint j = 0; j < 2; j++) { const char *kbd = keyboard[j]; + bool ended = false; for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { _keyboard[j][i] = Utf8Consume(&kbd); + /* Be lenient when the last characters are missing (is quite normal) */ + if (_keyboard[j][i] == '\0' || ended) { + ended = true; + _keyboard[j][i] = ' '; + continue; + } + if (IsPrintable(_keyboard[j][i])) { errormark[j][i] = ' '; } else { |