From: manish.r Date: Wed, 22 Jun 2016 09:04:50 +0000 (+0530) Subject: Adding Null Check for strings X-Git-Tag: accepted/tizen/common/20170111.171343~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8ec3430b107c0f61ef1215bbfc2b62a5b501d7d;p=platform%2Fcore%2Fcsapi%2Fpush.git Adding Null Check for strings Change-Id: I83a765994bca3d0ca47b0b75402c5788a1f8ae59 Signed-off-by: manish.r --- diff --git a/Tizen.Messaging/Push/PushImpl.cs b/Tizen.Messaging/Push/PushImpl.cs index 5924c00..5fb313b 100755 --- a/Tizen.Messaging/Push/PushImpl.cs +++ b/Tizen.Messaging/Push/PushImpl.cs @@ -51,30 +51,50 @@ namespace Tizen.Messaging.Push { ob.AppData = data; } + else + { + ob.AppData = ""; + } string message; result = Interop.Push.GetNotificationMessage(notification, out message); if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(message))) { ob.Message = message; } + else + { + ob.Message = ""; + } string sender; result = Interop.Push.GetNotificationSender(notification, out sender); if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(sender))) { ob.Sender = sender; } + else + { + ob.Sender = ""; + } string sessioninfo; result = Interop.Push.GetNotificationSessionInfo(notification, out sessioninfo); if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(sessioninfo))) { ob.SessionInfo = sessioninfo; } + else + { + ob.SessionInfo = ""; + } string requestid; result = Interop.Push.GetNotificationRequestId(notification, out requestid); if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(requestid))) { ob.RequestId = requestid; } + else + { + ob.RequestId = ""; + } int time; result = Interop.Push.GetNotificationTime(notification, out time); DateTime utc; @@ -113,7 +133,7 @@ namespace Tizen.Messaging.Push Log.Info(Interop.Push.LogTag, "PushServiceDisconnect Completed"); } - internal Task PushServerRegister() + internal async Task PushServerRegister() { Log.Info(Interop.Push.LogTag, "Register Called"); var task = new TaskCompletionSource(); @@ -140,10 +160,10 @@ namespace Tizen.Messaging.Push Log.Error(Interop.Push.LogTag, "Register failed with " + result); task.SetException(PushExceptionFactory.CreateResponseException(result)); } - return task.Task; + return await task.Task; } - internal Task PushServerUnregister() + internal async Task PushServerUnregister() { var task = new TaskCompletionSource(); Interop.Push.VoidResultCallback registerResult = (Interop.Push.Result regResult, IntPtr msgPtr, IntPtr userData) => @@ -167,7 +187,7 @@ namespace Tizen.Messaging.Push { task.SetException(PushExceptionFactory.CreateResponseException(result)); } - return task.Task; + return await task.Task; } internal string GetRegistrationId()