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.
This commit is contained in:
Philipp Wiesemann 2015-03-06 21:29:25 +01:00
parent 1686af726e
commit 8f4c2a8f9c
1 changed files with 3 additions and 2 deletions

View File

@ -447,8 +447,9 @@ EM_BOOL
Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)
{
char text[5];
Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text);
if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) {
SDL_SendKeyboardText(text);
}
return 1;
}