Quellcode durchsuchen

fix proto cmd crash problem in iperf example

idrey vor 2 Jahren
Ursprung
Commit
0f634bb6d7
1 geänderte Dateien mit 4 neuen und 0 gelöschten Zeilen
  1. 4 0
      examples/common_components/iperf/wifi_cmd.c

+ 4 - 0
examples/common_components/iperf/wifi_cmd.c

@@ -670,6 +670,10 @@ static int wifi_cmd_proto(int argc, char **argv)
     }
     wifi_mode_t mode;
     esp_wifi_get_mode(&mode);
+    if(WIFI_MODE_NULL == mode) {
+        ESP_LOGI(TAG, "current wifi mode is null");
+        return 1;
+    }
     int ifx = (WIFI_MODE_STA == mode) ? 0 : 1;
     if (proto_args.proto->count) {
         if (!strcmp(proto_args.proto->sval[0], "ax")) {