From bd1763b979b3f04a4e0e03676512250cc1483508 Mon Sep 17 00:00:00 2001 From: guo Date: Mon, 24 Apr 2023 17:06:54 +0800 Subject: [PATCH] [netdev] Add check if netdev->ops is null (#7362) --- components/net/netdev/src/netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c index 9f1165c52f..eca32f71a1 100644 --- a/components/net/netdev/src/netdev.c +++ b/components/net/netdev/src/netdev.c @@ -389,7 +389,7 @@ void netdev_set_default(struct netdev *netdev) netdev_default = netdev; /* 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); }