Per r90858 CR, throw MW exception on missing title context
authorRobin Pepermans <robin@users.mediawiki.org>
Wed, 7 Sep 2011 04:05:37 +0000 (04:05 +0000)
committerRobin Pepermans <robin@users.mediawiki.org>
Wed, 7 Sep 2011 04:05:37 +0000 (04:05 +0000)
includes/parser/Parser.php

index 2e8a07d..02cef7d 100644 (file)
@@ -690,14 +690,16 @@ class Parser {
         * @return Language
         */
        function getFunctionLang() {
-               global $wgLang;
-
                $target = $this->mOptions->getTargetLanguage();
                if ( $target !== null ) {
                        return $target;
-               } else {
-                       return $this->mOptions->getInterfaceMessage() ? $wgLang : $this->mTitle->getPageLanguage();
+               } elseif( $this->mOptions->getInterfaceMessage() ) {
+                       global $wgLang;
+                       return $wgLang;
+               } elseif( is_null( $this->mTitle ) ) {
+                       throw new MWException( __METHOD__.': $this->mTitle is null' );
                }
+               return $this->mTitle->getPageLanguage();
        }
 
        /**