From b8ee3625cd6301f703e15c840ecae8f34fb11814 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Sun, 7 Jun 2015 19:50:58 +0000
Subject: [PATCH] oops: Check if an agent exists

This is necessary for auto-assigned tickets
---
 include/class.ticket.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index c8f0d1afd..48057249b 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1941,10 +1941,11 @@ implements RestrictedAccess, Threadable {
 
         global $thisstaff;
         $data = array();
-        if ($staff->getId() == $thisstaff->getId())
+        if ($thisstaff && $staff->getId() == $thisstaff->getId())
             $data['claim'] = true;
         else
             $data['staff'] = $staff->getId();
+
         $this->logEvent('assigned', $data);
 
         return true;
-- 
GitLab