diff --git a/src/protocolbuffers/generator/php/MessageGenerator.php b/src/protocolbuffers/generator/php/MessageGenerator.php index 8f144e7..fba2cfd 100644 --- a/src/protocolbuffers/generator/php/MessageGenerator.php +++ b/src/protocolbuffers/generator/php/MessageGenerator.php @@ -543,7 +543,7 @@ public function generate(Printer $printer) if ($dict->getLeadingComments()) { $lines = preg_split("/\r?\n/", trim($dict->getLeadingComments())); foreach ($lines as $line) { - if ($line[0] == " ") { + if ($line && $line[0] == " ") { $line = substr($line, 1); } $printer->put(" * `comment`\n", "comment", $line);