Closed michael-milette closed 2 years ago
Thanks @michael-milette,
I was going to create a PR with this solution:
--- a/locallib.php
+++ b/locallib.php
@@ -194,7 +194,7 @@ function local_codechecker_get_line_of_code($line, $prettypath) {
$file = file($CFG->dirroot . '/' . $prettypath);
$lastfilename = $prettypath;
}
- $linecontents = $file[$line - 1];
+ $linecontents = $file[$line - 1] ?? '';
// Handle empty lines.
if (trim($linecontents) === '') {
$linecontents = 'Ø';
But yours is pretty equivalent, so I'll proceed to merge this once all tests have ended.
Ciao :-)
This fixes the handling of empty files. For more information, see #198 .
Let me know if you have any questions or concerns.
Best regards,
Michael Milette