From eb859b62067843f6b76664851ce0f8fd1016ea38 Mon Sep 17 00:00:00 2001 From: niulihua Date: Thu, 19 Aug 2021 00:19:54 -0700 Subject: [PATCH] IssueNo: https://gitee.com/openharmony/applications_sample_camera/issues/I46CTW Feature or Bugfix: Bugfix Binary Source:No Signed-off-by: niulihua Change-Id: Ic77592253cee3380f7d2bd3ebe2f2d57804f4c35 --- setting/setting/src/main/cpp/wpa_work.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/setting/setting/src/main/cpp/wpa_work.c b/setting/setting/src/main/cpp/wpa_work.c index e6f5723..49e44bc 100755 --- a/setting/setting/src/main/cpp/wpa_work.c +++ b/setting/setting/src/main/cpp/wpa_work.c @@ -69,6 +69,10 @@ static int StrMatch(const char *a, const char *b) static int SendCtrlCommand(const char *cmd, char *reply, size_t *replyLen) { + if (g_ctrlConn == NULL) { + printf("%s:%d [ERROR] control connect handle is null\n", __FUNCTION__, __LINE__); + return -1; + } size_t len = *replyLen - 1; wpa_ctrl_request(g_ctrlConn, cmd, strlen(cmd), reply, &len, 0); DumpString(reply, len, "SendCtrlCommand raw return"); @@ -405,9 +409,14 @@ int InitControlInterface() void* WpaScanThread(void *args) { int mySleep = 2; + int ret = 0; sleep(mySleep); if (g_ctrlConn == NULL) { - InitControlInterface(); + ret = InitControlInterface(); + if (ret == -1) { + printf("%s:%d [ERROR] InitControlInterface return error\n", __FUNCTION__, __LINE__); + return NULL; + } } char reply[100] = {0}; size_t replyLen = sizeof(reply); -- Gitee