From 3eaf6f3b990d86069453b1bda4ed377e67ccf571 Mon Sep 17 00:00:00 2001
From: Malf Furious <m@lfurio.us>
Date: Sun, 22 Jul 2018 02:25:54 -0400
Subject: Fix bug in function agent::isOwner()

If the argument doesn't have an owner, then an access error is thrown
when we try to do ->guid.  Since there is no owner, just return false.
Otherwise, do the comparision as usual.
---
 app/class/agent.class.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'app/class')

diff --git a/app/class/agent.class.php b/app/class/agent.class.php
index 6d0e20d..b4e6702 100644
--- a/app/class/agent.class.php
+++ b/app/class/agent.class.php
@@ -37,7 +37,10 @@ abstract class agent extends obj
      */
     public function isOwnerOf(obj $obj) : bool
     {
-        return $obj->getOwner()->guid == $this->guid;
+        if (!($own = $obj->getOwner()))
+            return false;
+
+        return $own->guid == $this->guid;
     }
 
     /*
-- 
cgit v1.2.3