Handle NULL return from SDL_DBus_GetContext()
authorSam Lantinga <slouken@libsdl.org>
Mon, 23 Apr 2018 19:20:12 -0700
changeset 11948b6ad849f76a4
parent 11947 89b721a030c0
child 11949 2db064e4a284
Handle NULL return from SDL_DBus_GetContext()
src/thread/pthread/SDL_systhread.c
     1.1 --- a/src/thread/pthread/SDL_systhread.c	Mon Apr 23 19:18:52 2018 -0700
     1.2 +++ b/src/thread/pthread/SDL_systhread.c	Mon Apr 23 19:20:12 2018 -0700
     1.3 @@ -200,7 +200,7 @@
     1.4      SDL_DBusContext *dbus = SDL_DBus_GetContext();
     1.5  
     1.6      /* Try getting minimum nice level: this is often greater than PRIO_MIN (-20). */
     1.7 -    if (!SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MinNiceLevel",
     1.8 +    if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MinNiceLevel",
     1.9                                              DBUS_TYPE_INT32, &rtkit_min_nice_level)) {
    1.10          rtkit_min_nice_level = -20;
    1.11      }
    1.12 @@ -218,13 +218,12 @@
    1.13      if (si32 < rtkit_min_nice_level)
    1.14          si32 = rtkit_min_nice_level;
    1.15  
    1.16 -    if (!SDL_DBus_CallMethodOnConnection(dbus->system_conn,
    1.17 +    if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn,
    1.18              RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadHighPriority",
    1.19              DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID,
    1.20              DBUS_TYPE_INVALID)) {
    1.21          return SDL_FALSE;
    1.22      }
    1.23 -
    1.24      return SDL_TRUE;
    1.25  }
    1.26