Fix null dereference in lpt.c

This commit is contained in:
Jasmine Iwanek
2022-03-13 17:16:11 -04:00
parent fc51359579
commit 591ff2c2c5

View File

@@ -1,3 +1,4 @@
/* Copyright holders: Sarah Walker
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
@@ -87,7 +88,7 @@ lpt_devices_init(void)
for (i = 0; i < PARALLEL_MAX; i++) {
lpt_ports[i].dt = (lpt_device_t *) lpt_devices[lpt_ports[i].device].device;
if (lpt_ports[i].dt)
if (lpt_ports[i].dt && lpt_ports[i].dt->init)
lpt_ports[i].priv = lpt_ports[i].dt->init(&lpt_ports[i]);
}
}