From 5cb01bf9f4f90bc6a5e2b75b400de61977c21e71 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 26 Feb 2016 15:57:48 +0900 Subject: [PATCH] Fix the exception about checking widget feature Change-Id: I5ab197ba3ec80bae9a37d1a6cc0b45f4d1f46c5a Signed-off-by: Hwankyu Jhun --- src/widget_app.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/src/widget_app.c b/src/widget_app.c index b77fe74..905b186 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -119,7 +119,7 @@ static gint __comp_by_id(gconstpointer a, gconstpointer b) { widget_context_s *wc = (widget_context_s*)a; - return strcmp(wc->id, (const char*)b); + return strcmp(wc->id, (const char*)b); } static widget_context_s* __find_context_by_id(const char *id) @@ -173,13 +173,11 @@ static int __instance_create(widget_class_h handle, const char *id, bundle *b) bundle_get_str(b, WIDGET_K_WIDTH, &w_str); bundle_get_str(b, WIDGET_K_HEIGHT, &h_str); - if (w_str) { + if (w_str) w = (int)g_ascii_strtoll(w_str, &remain, 10); - } - if (h_str) { + if (h_str) h = (int)g_ascii_strtoll(h_str, &remain, 10); - } contexts = g_list_append(contexts, wc); @@ -578,14 +576,20 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context, widget_class_h _widget_class_create(widget_class_s *prev, const char *class_id, widget_instance_lifecycle_callback_s callback, void *user_data) { + widget_class_s *wc; + if (!_is_widget_feature_enabled()) { _E("not supported"); set_last_result(WIDGET_ERROR_NOT_SUPPORTED); return NULL; } - widget_class_s *wc = (widget_class_s*)malloc(sizeof(widget_class_s)); + if (class_id == NULL) { + set_last_result(WIDGET_ERROR_INVALID_PARAMETER); + return NULL; + } + wc = (widget_class_s *)malloc(sizeof(widget_class_s)); if (wc == NULL) { _E("failed to malloc : %s", __FUNCTION__); set_last_result(WIDGET_ERROR_OUT_OF_MEMORY); @@ -609,27 +613,11 @@ widget_class_h _widget_class_create(widget_class_s *prev, const char *class_id, EXPORT_API widget_class_h widget_app_class_add(widget_class_h widget_class, const char *class_id, widget_instance_lifecycle_callback_s callback, void *user_data) { - if (!_is_widget_feature_enabled()) { - _E("not supported"); - set_last_result(WIDGET_ERROR_INVALID_PARAMETER); - return NULL; - } - - if (class_id == NULL) { - set_last_result(WIDGET_ERROR_INVALID_PARAMETER); - return NULL; - } - return _widget_class_create(widget_class, class_id, callback, user_data); } EXPORT_API widget_class_h widget_app_class_create(widget_instance_lifecycle_callback_s callback, void *user_data) { - if (!_is_widget_feature_enabled()) { - set_last_result(WIDGET_ERROR_INVALID_PARAMETER); - return NULL; - } - return _widget_class_create(class_provider, appid, callback, user_data); } -- 2.7.4