1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 23:50:11 +01:00

Handle NULL files in class Post

This commit is contained in:
8chan 2015-02-25 17:15:45 -08:00
parent 8db4baccca
commit 46ba60fff1

View File

@ -360,6 +360,7 @@ class Post {
if (isset($this->files) && $this->files) { if (isset($this->files) && $this->files) {
$this->files = is_string($this->files) ? json_decode($this->files) : $this->files; $this->files = is_string($this->files) ? json_decode($this->files) : $this->files;
// Compatibility for posts before individual file hashing // Compatibility for posts before individual file hashing
if ($this->files) {
foreach ($this->files as $i => &$file) { foreach ($this->files as $i => &$file) {
if (empty($file)) { if (empty($file)) {
unset($this->files[$i]); unset($this->files[$i]);
@ -368,6 +369,7 @@ class Post {
if (!isset($file->hash)) if (!isset($file->hash))
$file->hash = $this->filehash; $file->hash = $this->filehash;
} }
}
} }
$this->subject = utf8tohtml($this->subject); $this->subject = utf8tohtml($this->subject);