Fix HTMLFormField calling Message::setContext with null
authorThiemo Mättig <thiemo.maettig@wikimedia.de>
Wed, 4 May 2016 13:29:24 +0000 (15:29 +0200)
committerThiemo Mättig <thiemo.maettig@wikimedia.de>
Wed, 4 May 2016 13:29:24 +0000 (15:29 +0200)
This is a hotfix. If you think it's better to revert I2e6195b instead
please do so.

Bug: T134351
Change-Id: Ifcc832a731b18933bdf6edfd6eb7a5cd6046c3ba

includes/htmlform/HTMLFormField.php

index 380b11d..9f5e728 100644 (file)
@@ -28,7 +28,7 @@ abstract class HTMLFormField {
        protected $mShowEmptyLabels = true;
 
        /**
-        * @var HTMLForm
+        * @var HTMLForm|null
         */
        public $mParent;
 
@@ -1095,7 +1095,13 @@ abstract class HTMLFormField {
         * @return Message
         */
        protected function getMessage( $value ) {
-               return Message::newFromSpecifier( $value )->setContext( $this->mParent );
+               $message = Message::newFromSpecifier( $value );
+
+               if ( $this->mParent ) {
+                       $message->setContext( $this->mParent );
+               }
+
+               return $message;
        }
 
        /**