From 2fc026728a0b1e9e35a8ad3418d9c9e6e38b2b04 Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Sun, 15 Aug 2004 20:20:41 +0000 Subject: [PATCH] prevent crashing on [[{{FNORD}}]]. Doesn't return something beautiful, though. --- includes/OutputPage.php | 6 ++++++ includes/Skin.php | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 54db1f4ca1..e962f04ca7 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -807,6 +807,12 @@ class OutputPage { # Make title object $dbk = $dbkeys[$key]; $title = $titles[$key] = Title::makeTitle( $val, $dbk ); + + # Skip invalid entries. + # Result will be ugly, but prevents crash. + if ( is_null( $title ) ) { + continue; + } $pdbk = $pdbks[$key] = $title->getPrefixedDBkey(); # Check if it's in the link cache already diff --git a/includes/Skin.php b/includes/Skin.php index bfda48b175..dc697349a3 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1580,6 +1580,10 @@ class Skin { { global $wgOut, $wgUser; + # Fail gracefully + if ( ! isset($nt) ) + return "{$prefix}{$text}{$trail}"; + $fname = 'Skin::makeBrokenLinkObj'; wfProfileIn( $fname ); -- 2.20.1