Commit 57043825ba04c1cbf729123ceed09c8e033adcbb

Sam Lantinga 2023-04-04T12:33:41

Fixed crash if dbus can't be initialized (cherry picked from commit cf2c6fa58dea02edb870cff7090fd69f3dfbd081)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c
index d6484f7..244aa23 100644
--- a/src/core/linux/SDL_fcitx.c
+++ b/src/core/linux/SDL_fcitx.c
@@ -278,7 +278,8 @@ static SDL_bool FcitxCreateInputContext(SDL_DBusContext *dbus, const char *appna
 {
     const char *program = "program";
     SDL_bool retval = SDL_FALSE;
-    if (dbus->session_conn) {
+
+    if (dbus && dbus->session_conn) {
         DBusMessage *msg = dbus->message_new_method_call(FCITX_DBUS_SERVICE, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateInputContext");
         if (msg) {
             DBusMessage *reply = NULL;