Xi: don't crash on a NULL property name, just return None.

strcmp doesn't like NULL-pointers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-03-09 08:59:01 +10:00
parent 432a95032e
commit 0d9a42dc03

View File

@ -172,11 +172,17 @@ static long XIPropHandlerID = 1;
/** /**
* Return the atom assigned to the specified string or 0 if the atom isn't known * Return the atom assigned to the specified string or 0 if the atom isn't known
* to the DIX. * to the DIX.
*
* If name is NULL, None is returned.
*/ */
Atom Atom
XIGetKnownProperty(char *name) XIGetKnownProperty(char *name)
{ {
int i; int i;
if (!name)
return None;
for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++) for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
{ {
if (strcmp(name, dev_properties[i].name) == 0){ if (strcmp(name, dev_properties[i].name) == 0){