summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2017-06-29 09:44:27 (GMT)
committerHwankyu Jhun <h.jhun@samsung.com>2017-06-29 09:44:27 (GMT)
commit9ddc6696601e88236c404734066681e7dd91876b (patch)
tree3ed67eb4572537270ee15a75bb850cfac973a756
parent6fa70cac05b6a56d7ee974d60d8ea4f202f62051 (diff)
downloadapplication-9ddc6696601e88236c404734066681e7dd91876b.zip
application-9ddc6696601e88236c404734066681e7dd91876b.tar.gz
application-9ddc6696601e88236c404734066681e7dd91876b.tar.bz2
Fix exception handlingrefs/changes/05/136405/1
If the return value of the appsvc API is NULL pointer, the getter API should not return a negative error value. Change-Id: I1069186e3f11cd4010f87991f371a43eaabf2412 Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rwxr-xr-xapp_control/app_control.c65
1 files changed, 35 insertions, 30 deletions
diff --git a/app_control/app_control.c b/app_control/app_control.c
index d2ad6a0..55eda27 100755
--- a/app_control/app_control.c
+++ b/app_control/app_control.c
@@ -342,12 +342,13 @@ int app_control_get_operation(app_control_h app_control, char **operation)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
operation_value = aul_svc_get_operation(app_control->data);
- if (operation_value == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- *operation = strdup(operation_value);
- if (*operation == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ if (operation_value) {
+ *operation = strdup(operation_value);
+ if (*operation == NULL)
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ } else {
+ *operation = NULL;
+ }
return APP_CONTROL_ERROR_NONE;
}
@@ -375,12 +376,13 @@ int app_control_get_uri(app_control_h app_control, char **uri)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
uri_value = aul_svc_get_uri(app_control->data);
- if (uri_value == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- *uri = strdup(uri_value);
- if (*uri == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ if (uri_value) {
+ *uri = strdup(uri_value);
+ if (*uri == NULL)
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ } else {
+ *uri = NULL;
+ }
return APP_CONTROL_ERROR_NONE;
}
@@ -408,12 +410,13 @@ int app_control_get_mime(app_control_h app_control, char **mime)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
mime_value = aul_svc_get_mime(app_control->data);
- if (mime_value == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- *mime = strdup(mime_value);
- if (*mime == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ if (mime_value) {
+ *mime = strdup(mime_value);
+ if (*mime == NULL)
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ } else {
+ *mime = NULL;
+ }
return APP_CONTROL_ERROR_NONE;
}
@@ -441,12 +444,13 @@ int app_control_get_category(app_control_h app_control, char **category)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
category_value = aul_svc_get_category(app_control->data);
- if (category_value == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- *category = strdup(category_value);
- if (*category == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ if (category_value) {
+ *category = strdup(category_value);
+ if (*category == NULL)
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ } else {
+ *category = NULL;
+ }
return APP_CONTROL_ERROR_NONE;
}
@@ -486,12 +490,13 @@ int app_control_get_app_id(app_control_h app_control, char **app_id)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
app_id_value = aul_svc_get_appid(app_control->data);
- if (app_id_value == NULL)
- return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- *app_id = strdup(app_id_value);
- if (*app_id == NULL)
- return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ if (app_id_value) {
+ *app_id = strdup(app_id_value);
+ if (*app_id == NULL)
+ return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ } else {
+ *app_id = NULL;
+ }
return APP_CONTROL_ERROR_NONE;
}