MarkAHershberger has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/63258


Change subject: Make it work even on imports when title is null.
......................................................................

Make it work even on imports when title is null.

Change-Id: I75acf8860d15f5f47f16e1f35a5ea07cc88bac85
---
M VoteHooks.php
1 file changed, 17 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VoteNY 
refs/changes/58/63258/1

diff --git a/VoteHooks.php b/VoteHooks.php
index 7c9526a..eb69ae6 100644
--- a/VoteHooks.php
+++ b/VoteHooks.php
@@ -51,19 +51,24 @@
                        $type = intval( $args['type'] );
                }
 
-               $articleID = $wgOut->getTitle()->getArticleID();
-               switch( $type ) {
-                       case 0:
-                               $vote = new Vote( $articleID );
-                               break;
-                       case 1:
-                               $vote = new VoteStars( $articleID );
-                               break;
-                       default:
-                               $vote = new Vote( $articleID );
-               }
+               $output = null;
+               $title = $wgOut->getTitle();
+               if( $title ) {
 
-               $output = $vote->display();
+                       $articleID = $title->getArticleID();
+                       switch( $type ) {
+                               case 0:
+                                       $vote = new Vote( $articleID );
+                                       break;
+                               case 1:
+                                       $vote = new VoteStars( $articleID );
+                                       break;
+                               default:
+                                       $vote = new Vote( $articleID );
+                       }
+
+                       $output = $vote->display();
+               }
 
                wfProfileOut( __METHOD__ );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/63258
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I75acf8860d15f5f47f16e1f35a5ea07cc88bac85
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VoteNY
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to