aboutsummaryrefslogtreecommitdiff
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-12-15 18:03:59 -0500
committerDrew DeVault <sir@cmpwn.com>2016-12-15 19:01:41 -0500
commit8cef81d6f23adb66873ee5fd84aa7180b22624f2 (patch)
tree0739dff1b879b5a674dbd56e44ad4f4a44e941c7 /sway/ipc-server.c
parentd75a747a3ddc99f258025a923de1cf4821bf3115 (diff)
Handle some more memory allocation failures
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index de72beca..ba0cb310 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -414,7 +414,11 @@ void ipc_client_handle_command(struct ipc_client *client) {
struct libinput_device *device = input_devices->items[i];
char* identifier = libinput_dev_unique_id(device);
json_object *device_object = json_object_new_object();
- json_object_object_add(device_object, "identifier", json_object_new_string(identifier));
+ if (!identifier) {
+ json_object_object_add(device_object, "identifier", NULL);
+ } else {
+ json_object_object_add(device_object, "identifier", json_object_new_string(identifier));
+ }
json_object_array_add(inputs, device_object);
free(identifier);
}