From 8276bf603e92a98771af0e8eb86d15868246933f Mon Sep 17 00:00:00 2001
From: Thibault Debatty <thibault.debatty@gmail.com>
Date: Fri, 21 Dec 2018 09:35:15 +0100
Subject: [PATCH] Fix access to record

---
 web/app/Sensor/Ifconfig.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/web/app/Sensor/Ifconfig.php b/web/app/Sensor/Ifconfig.php
index 0a14f87..29d16a5 100644
--- a/web/app/Sensor/Ifconfig.php
+++ b/web/app/Sensor/Ifconfig.php
@@ -13,7 +13,11 @@ class Ifconfig extends AbstractSensor {
 
     public function report() {
 
-        $interfaces = $this->parseIfconfig($this->getLastRecord("ifconfig"));
+        $interfaces = [];
+        $record = $this->getLastRecord("ifconfig");
+        if ($record !== null) {
+            $interfaces = $this->parseIfconfig($record->ifconfig);
+        }
         return view("agent.ifconfig", [
             "server" => $this->getServer(),
             "interfaces" => $interfaces]);
-- 
GitLab