From f70b518b503769c8453c9cee8b421189d59f268f Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 9 Feb 2020 13:02:24 +0100 Subject: 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 --- application/controllers/Main.php | 9 +++++---- 1 file 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"])); + } } } -- cgit v1.2.3-24-g4f1b