Safety first... none of these *should* fail in an ideal world, but they in fact somet...
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 29 May 2008 18:15:05 +0000 (18:15 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 29 May 2008 18:15:05 +0000 (18:15 +0000)
includes/SearchEngine.php

index e9c31ef..50231d3 100644 (file)
@@ -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;
                                }
                        }