summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseungha.son <seungha.son@samsung.com>2016-09-20 19:53:00 +0900
committerseungha.son <seungha.son@samsung.com>2016-09-20 20:48:25 +0900
commitf51145ee20396400525781902ca18fe3a99e24eb (patch)
treefe83fa8f6c25a802453c66573a31a08f42652d73
parenta1bbc04c4f42f763856ac4f05ab1c0171b9af2b6 (diff)
downloadnotification-f51145ee20396400525781902ca18fe3a99e24eb.tar.gz
notification-f51145ee20396400525781902ca18fe3a99e24eb.tar.bz2
notification-f51145ee20396400525781902ca18fe3a99e24eb.zip
Add error check conditional statement
Signed-off-by: seungha.son <seungha.son@samsung.com> Change-Id: I4f43c3bfdbb95d73b805f2712bedf9004875b966
-rwxr-xr-xsrc/notification_internal.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/notification_internal.c b/src/notification_internal.c
index f3e400f..bfbae65 100755
--- a/src/notification_internal.c
+++ b/src/notification_internal.c
@@ -1346,6 +1346,9 @@ EXPORT_API int notification_get_ongoing_value_type(notification_h noti, notifica
EXPORT_API int notification_set_ongoing_value_type(notification_h noti, notification_ongoing_value_type_e type)
{
+ if (noti == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
if (type < NOTIFICATION_ONGOING_VALUE_TYPE_PERCENT || type > NOTIFICATION_ONGOING_VALUE_TYPE_TIME)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
@@ -1370,6 +1373,9 @@ EXPORT_API int notification_set_ongoing_time(notification_h noti, int current, i
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ if (current < 0 || duration < 0 || current > duration)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
noti->ongoing_current = current;
noti->ongoing_duration = duration;
@@ -1388,7 +1394,7 @@ EXPORT_API int notification_get_hide_timeout(notification_h noti, int *timeout)
EXPORT_API int notification_set_hide_timeout(notification_h noti, int timeout)
{
- if (noti == NULL)
+ if (noti == NULL || timeout < 0)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
noti->timeout = timeout;