input: don't assume outputs have names

If an output is unnamed and devices are in seats, the strcmp will crash.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
Derek Foreman
2015-03-17 13:22:35 -05:00
committed by Pekka Paalanen
parent e516c3bb80
commit f3723d911f
+2 -1
View File
@@ -82,7 +82,8 @@ device_added(struct udev_input *input, struct libinput_device *libinput_device)
if (output_name) { if (output_name) {
device->output_name = strdup(output_name); device->output_name = strdup(output_name);
wl_list_for_each(output, &c->output_list, link) wl_list_for_each(output, &c->output_list, link)
if (strcmp(output->name, device->output_name) == 0) if (output->name &&
strcmp(output->name, device->output_name) == 0)
evdev_device_set_output(device, output); evdev_device_set_output(device, output);
} else if (device->output == NULL && !wl_list_empty(&c->output_list)) { } else if (device->output == NULL && !wl_list_empty(&c->output_list)) {
output = container_of(c->output_list.next, output = container_of(c->output_list.next,