diff options
-rw-r--r-- | Vote.php | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -183,10 +183,11 @@ class VoteHooks { private static function parseVote($line) { $date = DateTime::createFromFormat('Y-m-d H:i', substr($line, 0, strlen('2022-10-03 10:00'))); $parts = explode(' ', substr($line, strlen('2022-10-03 10:00 ')), 3); - $user = Title::newFromText('User:' . rtrim(array_shift($parts), ':')); + $userTitle = Title::newFromText('User:' . rtrim(array_shift($parts), ':')); + $user = $userTitle ? $userTitle->getText() : null; $vote = strtolower(array_shift($parts)); $comment = array_shift($parts); - return ['date' => $date, 'userTitle' => $user, 'user' => $user->getText(), 'vote' => $vote, 'comment' => $comment]; + return ['date' => $date, 'userTitle' => $userTitle, 'user' => $user, 'vote' => $vote, 'comment' => $comment]; } private static function votingFormHtml($parser, $votes) { |