Skip to content
Snippets Groups Projects
Commit e3b333ed authored by JediKev's avatar JediKev
Browse files

thread: getId On Non-Object

This addresses issue 4347 where opening a ticket without an initial message
for the User and replying to it as an agent, fatally errors. This is because
osTicket does not check if there is a last message before getting the ID
from it. So it tries to lookup the ID of a non-object therefore fatally
erroring out.
parent da0c41b9
No related branches found
No related tags found
No related merge requests found
...@@ -2863,7 +2863,8 @@ implements TemplateVariable { ...@@ -2863,7 +2863,8 @@ implements TemplateVariable {
function addResponse($vars, &$errors) { function addResponse($vars, &$errors) {
$vars['threadId'] = $this->getId(); $vars['threadId'] = $this->getId();
$vars['userId'] = 0; $vars['userId'] = 0;
$vars['pid'] = $this->getLastMessage()->getId(); if ($message = $this->getLastMessage())
$vars['pid'] = $message->getId();
$vars['flags'] = 0; $vars['flags'] = 0;
switch ($vars['reply-to']) { switch ($vars['reply-to']) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment