[Shortcut] Add exception handling for GetTemplateList 11/149811/4 preview1-00203
authorMyungki Lee <mk5004.lee@samsung.com>
Wed, 13 Sep 2017 06:49:38 +0000 (15:49 +0900)
committerMyungki Lee <mk5004.lee@samsung.com>
Thu, 14 Sep 2017 02:30:22 +0000 (11:30 +0900)
Change-Id: Ia0ae4fa37f3c6202df36330bbc4dfaaaaed245f8
Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
src/Tizen.Applications.Shortcut/Tizen.Applications.ShortcutEvent/ShortcutEventManager.cs

index a4467d4..fba8ab1 100755 (executable)
@@ -197,6 +197,11 @@ namespace Tizen.Applications.Shortcut
         {
             shortcutTemplates.Clear();
 
+            if (string.IsNullOrEmpty(appId))
+            {
+                throw ShortcutErrorFactory.GetException(Interop.Shortcut.ErrorCode.InvalidParameter, null);
+            }
+
             Interop.Shortcut.ListCallback callback = (appName, iconPath, shortcutName, extrakey, extraData, user_data) =>
             {
                 ShortcutTemplate template = new ShortcutTemplate
@@ -213,7 +218,11 @@ namespace Tizen.Applications.Shortcut
                 return 0;
             };
 
-            Interop.Shortcut.GetList(appId, callback, IntPtr.Zero);
+            Interop.Shortcut.ErrorCode err = Interop.Shortcut.GetList(appId, callback, IntPtr.Zero);
+            if (err < Interop.Shortcut.ErrorCode.None)
+            {
+                throw ShortcutErrorFactory.GetException(err, "unable to get ShortcutTemplate Lists");
+            }
 
             return shortcutTemplates;
         }