From 7ecf213e334d19f21a077bc4fd763b4d3fc60464 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Wed, 24 Oct 2012 10:48:11 -0400
Subject: [PATCH] Make sure dept & topic objects are set before calling
 getSLAId()

---
 include/class.ticket.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 477135e0e..6b873b0a9 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -722,13 +722,14 @@ class Ticket {
         #     email filter? This method doesn't consider such a case
         if ($trump !== null) {
             $slaId = $trump;
-        } elseif ($this->getDept()->getSLAId()) {
+        } elseif ($this->getDept() && $this->getDept()->getSLAId()) {
             $slaId = $this->getDept()->getSLAId();
-        } elseif ($this->getTopicId() && $this->getTopic()) {
+        } elseif ($this->getTopic() && $this->getTopic()->getSLAId()) {
             $slaId = $this->getTopic()->getSLAId();
         } else {
             $slaId = $cfg->getDefaultSLAId();
         }
+
         return ($slaId && $this->setSLAId($slaId)) ? $slaId : false;
     }
 
-- 
GitLab