From 32f300af7fa150ec561cf58e30df910af5fedb0b Mon Sep 17 00:00:00 2001 From: Andrey Savchenko Date: Wed, 12 Aug 2015 00:14:33 +0300 Subject: [PATCH] Added check to catch event stops without matching starts Fixes #7 --- src/class-laps.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/class-laps.php b/src/class-laps.php index 32912a5..37089a5 100644 --- a/src/class-laps.php +++ b/src/class-laps.php @@ -102,6 +102,10 @@ class Laps { ) ); + if ( 'stop' === $event['action'] && ! self::$stopwatch->isStarted( $event['event'] ) ) { + return $input; + } + self::$stopwatch->$event['action']( $event['event'], $event['category'] ); return $input;