From b893ec78e10de9d29fcfc62e1cf67d6a72c7dfd0 Mon Sep 17 00:00:00 2001
From: Anton Aksola <anton.aksola@nebula.fi>
Date: Fri, 6 Jun 2014 11:52:25 +0300
Subject: fix: node#last= didn't handle nil temporary fix. Maybe node#last
 should check the type or we shouldn't use last for the nodes#next in the
 first place

---
 lib/oxidized/node.rb | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index 0f4c525..20aab76 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -95,12 +95,16 @@ module Oxidized
     end
 
     def last= job
-      ostruct = OpenStruct.new
-      ostruct.start  = job.start
-      ostruct.end    = job.end
-      ostruct.status = job.status
-      ostruct.time   = job.time
-      @last = ostruct
+      if job
+        ostruct = OpenStruct.new
+        ostruct.start  = job.start
+        ostruct.end    = job.end
+        ostruct.status = job.status
+        ostruct.time   = job.time
+        @last = ostruct
+      else
+        @last = nil
+      end
     end
 
     def reset
-- 
cgit v1.2.3