From: Myungki Lee Date: Wed, 13 Sep 2017 06:49:38 +0000 (+0900) Subject: [Shortcut] Add exception handling for GetTemplateList X-Git-Tag: preview1-00203^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a142082d98e0e29e999bde057b190583013db718;hp=1bd94659bb69749a766ac38c040599f9a1ebe855;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Shortcut] Add exception handling for GetTemplateList Change-Id: Ia0ae4fa37f3c6202df36330bbc4dfaaaaed245f8 Signed-off-by: Myungki Lee --- diff --git a/src/Tizen.Applications.Shortcut/Tizen.Applications.ShortcutEvent/ShortcutEventManager.cs b/src/Tizen.Applications.Shortcut/Tizen.Applications.ShortcutEvent/ShortcutEventManager.cs index a4467d4..fba8ab1 100755 --- a/src/Tizen.Applications.Shortcut/Tizen.Applications.ShortcutEvent/ShortcutEventManager.cs +++ b/src/Tizen.Applications.Shortcut/Tizen.Applications.ShortcutEvent/ShortcutEventManager.cs @@ -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; }