From 9edeceed92c2ae4119d28a9f7efc0a2b0143b2ab Mon Sep 17 00:00:00 2001 From: "chleun.moon" Date: Wed, 1 Nov 2017 15:37:59 +0900 Subject: [PATCH] [Connection] ConnectionProfileManager.GetCurrentProfile() returns null if there is no connection Change-Id: I419dac066d97c634d2184b677e9845f8266b794a Signed-off-by: Cheoleun Moon --- .../ConnectionInternalManager.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs index 2725077..56f6290 100755 --- a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs @@ -766,11 +766,19 @@ namespace Tizen.Network.Connection int ret = Interop.Connection.GetCurrentProfile(GetHandle(), out ProfileHandle); if ((ConnectionError)ret != ConnectionError.None) { - Log.Error(Globals.LogTag, "It failed to get current profile, " + (ConnectionError)ret); - ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); - ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); - ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); - ConnectionErrorFactory.ThrowConnectionException(ret); + if ((ConnectionError)ret == ConnectionError.NoConnection) + { + Log.Error(Globals.LogTag, "No connection " + (ConnectionError)ret); + return null; + } + else + { + Log.Error(Globals.LogTag, "It failed to get current profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } } ConnectionProfile Profile = new ConnectionProfile(ProfileHandle); -- 2.7.4