diff --git a/include/class.ticket.php b/include/class.ticket.php
index 477135e0e997fd95057bb35d6f6ac302579c663b..6b873b0a90fc7f4c0136de201b810998c559f201 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;
     }