From d7cc6a5882f1f5c41b7be928ba725662eb08fbf3 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 6 Aug 2015 11:30:26 -0500
Subject: [PATCH] events: Fix crash rendering thread for events with deleted
 users

---
 include/class.thread.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/class.thread.php b/include/class.thread.php
index 5b412f235..bf4d4010e 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1574,9 +1574,9 @@ class ThreadEvent extends VerySimpleModel {
 
     function getUserName() {
         if ($this->uid && $this->uid_type == 'S')
-            return $this->agent->getName();
+            return $this->agent ? $this->agent->getName() : $this->username;
         if ($this->uid && $this->uid_type == 'U')
-            return $this->user->getName();
+            return $this->user ? $this->user->getName() : $this->username;
         return $this->username;
     }
 
-- 
GitLab