Safety check before using row values.

FossilOrigin-Name: 762164d99717433a03474f5e927c58540f5a2863404e3c69f8f83fd04cad624f
This commit is contained in:
mahlon@laika.com 2014-10-28 18:58:07 +00:00
parent 7c2954b0ad
commit 649332a422
2 changed files with 8 additions and 9 deletions

View file

@ -179,9 +179,13 @@ class Symphony::Metronome::ScheduledEvent
# a HUP.
#
if self.event.recurring
now = Time.now
last = self.ds.first[ :lastrun ]
return false if last && now - last < self.event.interval
now = Time.now
row = self.ds.first
if row
last = row[ :lastrun ]
return false if last && now - last < self.event.interval
end
# Mark the time this recurring event was fired.
self.ds.update( :lastrun => Time.now )