elput: Trap for null physical seat name

It could be possible that libinput_seat_get_physical_name does not
return a valid name, in which case searching for seats will fail. This
small patch just checks for a valid name being passed in and if not,
searches for a default seat name

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This commit is contained in:
Chris Michael 2016-06-16 13:01:33 -04:00
parent de0d69ea2d
commit 3adf6fdbae
1 changed files with 7 additions and 1 deletions

View File

@ -72,6 +72,7 @@ _udev_seat_create(Elput_Manager *em, const char *name)
eseat = calloc(1, sizeof(Elput_Seat));
if (!eseat) return NULL;
eseat->manager = em;
eseat->name = eina_stringshare_add(name);
@ -102,10 +103,15 @@ _udev_seat_named_get(Elput_Manager *em, const char *name)
Elput_Seat *eseat;
Eina_List *l;
if (!name) name = "seat0";
EINA_LIST_FOREACH(em->input.seats, l, eseat)
if (!strcmp(eseat->name, name)) return eseat;
return _udev_seat_create(em, name);
eseat = _udev_seat_create(em, name);
if (!eseat) return NULL;
return eseat;
}
static Elput_Seat *