Skin: Don't double-check for non-existing skin in newFromKey()
authorBartosz Dziewoński <matma.rex@gmail.com>
Sun, 10 Aug 2014 01:24:58 +0000 (03:24 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Sun, 10 Aug 2014 01:35:59 +0000 (03:35 +0200)
normalizeKey() should have already handled this.

Change-Id: Idf2510ec86841ed18d589f392a30db1b41ac0c24

includes/skins/Skin.php

index 6ba1efd..c4de2ad 100644 (file)
@@ -148,16 +148,12 @@ abstract class Skin extends ContextSource {
         */
        static function &newFromKey( $key ) {
                wfDeprecated( __METHOD__, '1.24' );
-               global $wgFallbackSkin;
 
                $key = Skin::normalizeKey( $key );
                $factory = SkinFactory::getDefaultInstance();
-               try {
-                       $skin = $factory->makeSkin( $key );
-               } catch ( SkinException $e ) {
-                       $skin = $factory->makeSkin( $wgFallbackSkin );
-               }
 
+               // normalizeKey() guarantees that a skin with this key will exist.
+               $skin = $factory->makeSkin( $key );
                return $skin;
        }