[WiFi] GetConnectedAP() Returns null if there is no connected AP 49/158149/1
authorchleun.moon <chleun.moon@samsung.com>
Mon, 30 Oct 2017 06:24:32 +0000 (15:24 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Mon, 30 Oct 2017 06:24:49 +0000 (15:24 +0900)
Change-Id: Ib2b9a1806a93d1f42a6116c5baaf4b845135fda3
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs

index bd56b97..3a40168 100755 (executable)
@@ -264,8 +264,16 @@ namespace Tizen.Network.WiFi
             int ret = Interop.WiFi.GetConnectedAP(GetSafeHandle(), out apHandle);
             if (ret != (int)WiFiError.None)
             {
-                Log.Error(Globals.LogTag, "Failed to connect with AP, Error - " + (WiFiError)ret);
-                WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.get");
+                if (ret == (int)WiFiError.NoConnectionError)
+                {
+                    Log.Error(Globals.LogTag, "No connection " + (WiFiError)ret);
+                    return null;
+                }
+                else
+                {
+                    Log.Error(Globals.LogTag, "Failed to connect with AP, Error - " + (WiFiError)ret);
+                    WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.get");
+                }
             }
             WiFiAP ap = new WiFiAP(apHandle);
             return ap;