[search] Fix method call on null value
authorErik Bernhardson <ebernhardson@wikimedia.org>
Thu, 29 Oct 2015 01:37:22 +0000 (18:37 -0700)
committerErik Bernhardson <ebernhardson@wikimedia.org>
Thu, 29 Oct 2015 05:02:24 +0000 (22:02 -0700)
Seeing these pop up in the production logs. This can be null under
certain circumstances, so expect and handle it.

Change-Id: I25a355174e0ad93280eccffd4ec711a641d14bf3

includes/specials/SpecialSearch.php

index d6ce6a4..fd24521 100644 (file)
@@ -387,7 +387,8 @@ class SpecialSearch extends SpecialPage {
                        $textMatches->free();
                }
 
-               $hasOtherResults = $textMatches->hasInterwikiResults( SearchResultSet::INLINE_RESULTS );
+               $hasOtherResults = $textMatches &&
+                       $textMatches->hasInterwikiResults( SearchResultSet::INLINE_RESULTS );
 
                if ( $num === 0 ) {
                        if ( $textStatus ) {