From a142082d98e0e29e999bde057b190583013db718 Mon Sep 17 00:00:00 2001 From: Myungki Lee Date: Wed, 13 Sep 2017 15:49:38 +0900 Subject: [PATCH] [Shortcut] Add exception handling for GetTemplateList Change-Id: Ia0ae4fa37f3c6202df36330bbc4dfaaaaed245f8 Signed-off-by: Myungki Lee --- .../Tizen.Applications.ShortcutEvent/ShortcutEventManager.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; } -- 2.7.4