8000 Small bugfix with array index (#24) · symfony-tools/code-block-checker@8bc3354 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8bc3354

Browse files
authored
Small bugfix with array index (#24)
1 parent 18a6677 commit 8bc3354

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Issue/Issue.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public function getErroredLine()
7878
{
7979
if (null === $this->erroredLine) {
8080
$lines = explode(PHP_EOL, $this->node->getValue());
81-
$this->erroredLine = $lines[$this->localLine - 1];
81+
// We do -1 because the $lines array is zero-index and the error message is 1-index
82+
$this->erroredLine = $lines[max(0, $this->localLine - 1)];
8283
}
8384

8485
return $this->erroredLine;

0 commit comments

Comments
 (0)
0