diff --git a/src/agent.c b/src/agent.c
index ebf203f1998977d5124068e10eb0fc6d11a1a99b..a780ecf9c3d04d09c2a09c7b31931a09a9e4d6fc 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -1805,6 +1805,15 @@ static int agent_modify_assoc_status(struct netif_ap *ap, bool allowed)
 {
 	int ret = 0;
 
+	if (!ap) {
+		trace("%s: ap is NULL\n", __func__);
+		return -EINVAL;
+	}
+	if (!ap->cfg) {
+		trace("%s: ap has NULL cfg\n", __func__);
+		return -EINVAL;
+	}
+
 	ret = wifi_set_ap_mbo_association_mode(ap->ifname, !allowed);
 	if (!ret) {
 		ap->cfg->disallow_assoc = !allowed;
@@ -7109,7 +7118,7 @@ static void agent_fetch_ap_stats(struct agent *a)
 
 			snprintf(objname, sizeof(objname), "wifi.ap.%s", ap->ifname);
 #if (EASYMESH_VERSION >= 6)
-			if (ap->cfg->mld_id) {
+			if (ap->cfg && ap->cfg->mld_id) {
 				struct mld_credential *mldcred;
 
 				mldcred = agent_get_mld_credential_by_id(&a->cfg,
diff --git a/src/assoc_ctrl.c b/src/assoc_ctrl.c
index 3fd867c201c75b05f56c00787bc55f3975431093..29d0a26f93fa2bccb9f315432190ab9ed5d0a83d 100644
--- a/src/assoc_ctrl.c
+++ b/src/assoc_ctrl.c
@@ -243,6 +243,11 @@ int assoc_ctrl_sync_from_config(struct agent *a, struct netif_ap *ap)
 	int num_sta = 0;
 	int ret = 0;
 
+	if (!ap || !ap->cfg) {
+		trace("%s: ap has NULL cfg\n", __func__);
+		return -EINVAL;
+	}
+
 	/* 1. Add STAs missing in runtime list */
 	list_for_each_entry(x, &ap->cfg->assoc_ctrllist, list) {
 		memcpy(stalist[num_sta++], x->macaddr, 6);