aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2010-05-08 18:30:00 +0000
committerJohannes Schickel2010-05-08 18:30:00 +0000
commitada03c57b349ab9d30f7ee1612ff52c77eda84cf (patch)
treeb0020b6694a81a15861c160dad6a5e5a1a9f52d9
parent78a99ce6a698c855ace0d5d25ba630fdafa50048 (diff)
downloadscummvm-rg350-ada03c57b349ab9d30f7ee1612ff52c77eda84cf.tar.gz
scummvm-rg350-ada03c57b349ab9d30f7ee1612ff52c77eda84cf.tar.bz2
scummvm-rg350-ada03c57b349ab9d30f7ee1612ff52c77eda84cf.zip
Prevent editable widgets from adding various characters when F1-F12 is pressed by the user.
Formerly the code just casted the "ascii" value of the key event to "byte" and thus truncating the character value. Now that would be fine, if we would not allow values >= 256 in the ascii field, for example 322 for F8 which in turn resulted in a "B" added to the editable field. I just added a check for the values being in the byte range before doing the cast, which fixes this. svn-id: r48967
-rw-r--r--gui/editable.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/gui/editable.cpp b/gui/editable.cpp
index b907408873..723384ed44 100644
--- a/gui/editable.cpp
+++ b/gui/editable.cpp
@@ -208,7 +208,7 @@ bool EditableWidget::handleKeyDown(Common::KeyState state) {
}
void EditableWidget::defaultKeyDownHandler(Common::KeyState &state, bool &dirty, bool &forcecaret, bool &handled) {
- if (tryInsertChar((byte)state.ascii, _caretPos)) {
+ if (state.ascii < 256 && tryInsertChar((byte)state.ascii, _caretPos)) {
_caretPos++;
dirty = true;
forcecaret = true;