Emscripten: Fixed ignoring return value of internal function.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Fri, 06 Mar 2015 21:29:25 +0100
changeset 937871743b696c06
parent 9377 4c29dc2baaa8
child 9379 ff0e77a2f48c
Emscripten: Fixed ignoring return value of internal function.

If the function Emscripten_ConvertUTF32toUTF8() failed (should currently not be
possible) a not terminated string would have been sent as text input event.
src/video/emscripten/SDL_emscriptenevents.c
     1.1 --- a/src/video/emscripten/SDL_emscriptenevents.c	Fri Mar 06 21:26:37 2015 +0100
     1.2 +++ b/src/video/emscripten/SDL_emscriptenevents.c	Fri Mar 06 21:29:25 2015 +0100
     1.3 @@ -447,8 +447,9 @@
     1.4  Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)
     1.5  {
     1.6      char text[5];
     1.7 -    Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text);
     1.8 -    SDL_SendKeyboardText(text);
     1.9 +    if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) {
    1.10 +        SDL_SendKeyboardText(text);
    1.11 +    }
    1.12      return 1;
    1.13  }
    1.14