diff options
author | Florian Pritz <bluewind@xinu.at> | 2020-02-09 13:02:24 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2020-02-09 13:02:24 +0100 |
commit | f70b518b503769c8453c9cee8b421189d59f268f (patch) | |
tree | be5700130548c61ab0e3448bfdf673b4515aa857 /application/controllers | |
parent | da55f810ffbfbf71b76bf8934086ac060f484536 (diff) |
Fix error when repasting non-existent ID
We shouldn't treat a possibly boolean value as an array
(`$filedata["data_id"]`).
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers')
-rw-r--r-- | application/controllers/Main.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/application/controllers/Main.php b/application/controllers/Main.php index 3b5fe353e..9db63b39f 100644 --- a/application/controllers/Main.php +++ b/application/controllers/Main.php @@ -465,10 +465,11 @@ class Main extends MY_Controller { if ($repaste_id) { $filedata = $this->mfile->get_filedata($repaste_id); - - $pygments = new \libraries\Pygments($this->mfile->file($filedata["data_id"]), $filedata["mimetype"], $filedata["filename"]); - if ($filedata !== false && $pygments->can_highlight()) { - $this->data["textarea_content"] = file_get_contents($this->mfile->file($filedata["data_id"])); + if ($filedata !== false) { + $pygments = new \libraries\Pygments($this->mfile->file($filedata["data_id"]), $filedata["mimetype"], $filedata["filename"]); + if ($pygments->can_highlight()) { + $this->data["textarea_content"] = file_get_contents($this->mfile->file($filedata["data_id"])); + } } } |