r89980 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89979‎ | r89980 | r89981 >
Date:16:57, 13 June 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
check for null where null might occur
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Property.php
@@ -186,19 +186,39 @@
187187 }
188188
189189 public function getShortWikiText( $linked = null ) {
190 - return $this->isVisible() ? $this->highlightText( $this->getWikiPageValue()->getShortWikiText( $linked ) ) : '';
 190+ if ( $this->isVisible() ) {
 191+ $wikiPageValue = $this->getWikiPageValue();
 192+ return is_null( $wikiPageValue ) ? '' : $this->highlightText( $wikiPageValue->getShortWikiText( $linked ) );
 193+ } else {
 194+ return '';
 195+ }
191196 }
192197
193198 public function getShortHTMLText( $linker = null ) {
194 - return $this->isVisible() ? $this->highlightText( $this->getWikiPageValue()->getShortHTMLText( $linker ) ) : '';
 199+ if ( $this->isVisible() ) {
 200+ $wikiPageValue = $this->getWikiPageValue();
 201+ return is_null( $wikiPageValue ) ? '' : $this->highlightText( $wikiPageValue->getShortHTMLText( $linked ) );
 202+ } else {
 203+ return '';
 204+ }
195205 }
196206
197207 public function getLongWikiText( $linked = null ) {
198 - return $this->isVisible() ? $this->highlightText( $this->getWikiPageValue()->getLongWikiText( $linked ) ) : '';
 208+ if ( $this->isVisible() ) {
 209+ $wikiPageValue = $this->getWikiPageValue();
 210+ return is_null( $wikiPageValue ) ? '' : $this->highlightText( $wikiPageValue->getLongWikiText( $linked ) );
 211+ } else {
 212+ return '';
 213+ }
199214 }
200215
201216 public function getLongHTMLText( $linker = null ) {
202 - return $this->isVisible() ? $this->highlightText( $this->getWikiPageValue()->getLongHTMLText( $linker ) ) : '';
 217+ if ( $this->isVisible() ) {
 218+ $wikiPageValue = $this->getWikiPageValue();
 219+ return is_null( $wikiPageValue ) ? '' : $this->highlightText( $wikiPageValue->getLongHTMLText( $linked ) );
 220+ } else {
 221+ return '';
 222+ }
203223 }
204224
205225 public function getWikiValue() {