linux: Don't crash if fcitx support is requested but unavailable.

Fixes Bugzilla #3642.
This commit is contained in:
Ryan C. Gordon 2017-05-29 02:48:51 -04:00
parent 29a047df39
commit b135557df9
2 changed files with 24 additions and 9 deletions

View file

@ -87,8 +87,20 @@ SDL_IME_Init(void)
{
InitIME();
if (SDL_IME_Init_Real)
return SDL_IME_Init_Real();
if (SDL_IME_Init_Real) {
if (SDL_IME_Init_Real()) {
return SDL_TRUE;
}
/* uhoh, the IME implementation's init failed! Disable IME support. */
SDL_IME_Init_Real = NULL;
SDL_IME_Quit_Real = NULL;
SDL_IME_SetFocus_Real = NULL;
SDL_IME_Reset_Real = NULL;
SDL_IME_ProcessKeyEvent_Real = NULL;
SDL_IME_UpdateTextRect_Real = NULL;
SDL_IME_PumpEvents_Real = NULL;
}
return SDL_FALSE;
}