Skip to content
Snippets Groups Projects
Commit 29c4cba0 authored by Jared Hancock's avatar Jared Hancock
Browse files

thread: Fix crash processing problem attachments

The ThreadEntry::normalizeFileInfo() method is called from ::create(), but
before the thread entry is saved. Therefore, the ::getThread() and
::getObject() methods will likely not return a valid object for posting the
thread message.
parent afd63e11
No related branches found
No related tags found
No related merge requests found
......@@ -913,9 +913,18 @@ implements TemplateVariable {
_S($error_descriptions[$error]));
}
// No need to log the missing-file error number
if ($error != UPLOAD_ERR_NO_FILE)
$this->getThread()->getObject()->logNote(
_S('File Import Error'), $error, _S('SYSTEM'), false);
if ($error != UPLOAD_ERR_NO_FILE
&& ($thread = $this->getThread())
) {
// Log to the thread directly, since alerts should be
// suppressed and this is defintely a system message
$thread->addNote(array(
'title' => _S('File Import Error'),
'note' => new TextThreadEntryBody($error),
'poster' => 'SYSTEM',
'staffId' => 0,
));
}
continue;
}
......@@ -2478,7 +2487,7 @@ implements TemplateVariable {
));
}
function addNote($vars, &$errors) {
function addNote($vars, &$errors=array()) {
//Add ticket Id.
$vars['threadId'] = $this->getId();
......
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