From: Nicholas Pisarro, Jr Date: Tue, 7 Dec 2004 13:10:56 +0000 (+0000) Subject: Fixed a problem when displaying the New Image Gallery. X-Git-Tag: 1.5.0alpha1~1135 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=96c69181aeb5421f608e84cdf61118e4bc9194c7;p=lhc%2Fweb%2Fwiklou.git Fixed a problem when displaying the New Image Gallery. Check to make sure a valid name object is returned by "Title". This may occur if a record is not valid in the DB. --- diff --git a/includes/SpecialNewimages.php b/includes/SpecialNewimages.php index 9d0d51b461..4ea315bfb3 100644 --- a/includes/SpecialNewimages.php +++ b/includes/SpecialNewimages.php @@ -84,11 +84,15 @@ function wfSpecialNewimages() { $ut = $s->img_user_text; $nt = Title::newFromText( $name, NS_IMAGE ); - $img = Image::newFromTitle( $nt ); - $ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut ); - - $gallery->add( $img, $ul.'
'.$wgLang->timeanddate( $s->img_timestamp, true ).'
' ); - $i++; + + # We may not get an object back from Title if there is name problem. + if ( is_object($nt) ) { + $img = Image::newFromTitle( $nt ); + $ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut ); + + $gallery->add( $img, $ul.'
'.$wgLang->timeanddate( $s->img_timestamp, true ).'
' ); + $i++; + } } $wgOut->addHTML( $gallery->toHTML() ); $dbr->freeResult( $res );