Make sure we actually have a dev before dereferencing in case someone

botches and sends us a NULL pointer.  The other code in this file seems
to expect it to be able to handle it behaving this way.
This commit is contained in:
Alfred Perlstein 2003-03-13 06:29:44 +00:00
parent de950c003c
commit 569d3c4bf0

View File

@ -1154,7 +1154,7 @@ device_get_devclass(device_t dev)
const char *
device_get_name(device_t dev)
{
if (dev->devclass)
if (dev != NULL && dev->devclass)
return (devclass_get_name(dev->devclass));
return (NULL);
}