diff --git a/src/pocketmine/CrashDump.php b/src/pocketmine/CrashDump.php index 99d03d807..0eb136908 100644 --- a/src/pocketmine/CrashDump.php +++ b/src/pocketmine/CrashDump.php @@ -212,11 +212,11 @@ class CrashDump{ $this->addLine("Code:"); $this->data["code"] = []; - if($this->server->getProperty("auto-report.send-code", true) !== false){ + if($this->server->getProperty("auto-report.send-code", true) !== false and file_exists($error["fullFile"])){ $file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES); - for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10; ++$l){ - $this->addLine("[" . ($l + 1) . "] " . @$file[$l]); - $this->data["code"][$l + 1] = @$file[$l]; + for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10 and isset($file[$l]); ++$l){ + $this->addLine("[" . ($l + 1) . "] " . $file[$l]); + $this->data["code"][$l + 1] = $file[$l]; } }