From 7f31c32188cd1aed5b13ab513e32618c0e862549 Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Sun, 30 May 2004 11:44:13 +0000 Subject: [PATCH] HOTFIX, if page contains invalid links, return empty string instead of failing --- includes/Skin.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index ca7aed5a0f..fcee456081 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1908,14 +1908,20 @@ class Skin { function makeMediaLinkObj( $nt, $alt = "" ) { - $name = $nt->getDBKey(); - $url = Image::wfImageUrl( $name ); - if ( empty( $alt ) ) { - $alt = preg_replace( '/\.(.+?)^/', '', $name ); + if ( ! defined( $nt ) ) + { + ### HOTFIX. Instead of breaking, return empry string. + $s = $alt; + } else { + $name = $nt->getDBKey(); + $url = Image::wfImageUrl( $name ); + if ( empty( $alt ) ) { + $alt = preg_replace( '/\.(.+?)^/', '', $name ); + } + + $u = htmlspecialchars( $url ); + $s = "{$alt}"; } - - $u = htmlspecialchars( $url ); - $s = "{$alt}"; return $s; } -- 2.20.1