From: Brion Vibber Date: Thu, 29 May 2008 18:15:05 +0000 (+0000) Subject: Safety first... none of these *should* fail in an ideal world, but they in fact somet... X-Git-Tag: 1.31.0-rc.0~47301 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=d39ba4d673a1a62615fa1886d4fa44a97f6417b4;p=lhc%2Fweb%2Fwiklou.git Safety first... none of these *should* fail in an ideal world, but they in fact sometimes do. So.... :D --- diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index e9c31efec9..50231d3c93 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -73,27 +73,27 @@ class SearchEngine { # Now try all lower case (i.e. first letter capitalized) # $title = Title::newFromText( $wgContLang->lc( $term ) ); - if ( $title->exists() ) { + if ( $title && $title->exists() ) { return $title; } # Now try capitalized string # $title = Title::newFromText( $wgContLang->ucwords( $term ) ); - if ( $title->exists() ) { + if ( $title && $title->exists() ) { return $title; } # Now try all upper case # $title = Title::newFromText( $wgContLang->uc( $term ) ); - if ( $title->exists() ) { + if ( $title && $title->exists() ) { return $title; } # Now try Word-Caps-Breaking-At-Word-Breaks, for hyphenated names etc $title = Title::newFromText( $wgContLang->ucwordbreaks($term) ); - if ( $title->exists() ) { + if ( $title && $title->exists() ) { return $title; } @@ -101,11 +101,11 @@ class SearchEngine { if( !$wgCapitalLinks ) { // Catch differs-by-first-letter-case-only $title = Title::newFromText( $wgContLang->ucfirst( $term ) ); - if ( $title->exists() ) { + if ( $title && $title->exists() ) { return $title; } $title = Title::newFromText( $wgContLang->lcfirst( $term ) ); - if ( $title->exists() ) { + if ( $title && $title->exists() ) { return $title; } }