[Applications] Modify args handling (#662)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Thu, 17 Jan 2019 00:08:20 +0000 (09:08 +0900)
committerpjh9216 <jh9216.park@samsung.com>
Thu, 17 Jan 2019 00:08:20 +0000 (09:08 +0900)
If args is null, throwing ArgumentNullException is occurred.
The null check logic is unnecessary. It's removed.
This patch checks the length of args before copying args.

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 732c37c..b2c48c4
@@ -112,18 +112,13 @@ namespace Tizen.Applications
             _backend.AddEventHandler<RegionFormatChangedEventArgs>(EventType.RegionFormatChanged, OnRegionFormatChanged);
             _backend.AddEventHandler<DeviceOrientationEventArgs>(EventType.DeviceOrientationChanged, OnDeviceOrientationChanged);
 
-            string[] argsClone = null;
-
-            if (args == null)
-            {
-                argsClone = new string[1];
-            }
-            else
+            string[] argsClone = new string[args.Length + 1];
+            if (args.Length > 1)
             {
-                argsClone = new string[args.Length + 1];
                 args.CopyTo(argsClone, 1);
             }
             argsClone[0] = string.Empty;
+
             _backend.Run(argsClone);
         }