[netdev] Add check if netdev->ops is null (#7362)

This commit is contained in:
guo 2023-04-24 17:06:54 +08:00 committed by GitHub
parent fbc1d6f4fd
commit bd1763b979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -389,7 +389,7 @@ void netdev_set_default(struct netdev *netdev)
netdev_default = netdev; netdev_default = netdev;
/* execture the default network interface device in the current network stack */ /* execture the default network interface device in the current network stack */
if (netdev->ops->set_default) if (netdev->ops && netdev->ops->set_default)
{ {
netdev->ops->set_default(netdev); netdev->ops->set_default(netdev);
} }