summaryrefslogtreecommitdiff
path: root/Vote.php
diff options
context:
space:
mode:
Diffstat (limited to 'Vote.php')
-rw-r--r--Vote.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/Vote.php b/Vote.php
index 4f74e15..8265604 100644
--- a/Vote.php
+++ b/Vote.php
@@ -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) {