[Timer] Do not deactivate alarm if is already deactivated 50/106450/3
authorKamil Lipiszko <k.lipiszko@samsung.com>
Wed, 21 Dec 2016 14:13:49 +0000 (15:13 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Wed, 4 Jan 2017 13:14:00 +0000 (05:14 -0800)
Change-Id: If4434428f8333c13cff78d174c6f393469a9ee05

clock/src/Model/Timer.cpp

index beea864..97d34ab 100644 (file)
@@ -145,6 +145,11 @@ bool Timer::ActivateAlarm(int delay)
 
 bool Timer::DeactivateAlarm()
 {
+       if (!alarm_id_) {
+               WRN("No alarm to deactivate");
+               return false;
+       }
+
        int ret = alarm_cancel(alarm_id_);
        if (ret != ALARM_ERROR_NONE) {
                ERR("alarm_cancel failed[%d]: %s", ret, get_error_message(ret));