From 925846c7d5bc7523cfd765ee57a9843cae1d3430 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 25 Oct 2008 16:23:09 +0000 Subject: [PATCH] Do a last check before creating the object to not throw a fatal error when calling api.php?format= --- includes/api/ApiMain.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 1fc65f3154..35c14262c4 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -228,6 +228,8 @@ class ApiMain extends ApiBase { * Create an instance of an output formatter by its name */ public function createPrinterByName($format) { + if( !isset( $this->mFormats[$format] ) ) + $this->dieUsage( "Unrecognized format: {$format}", 'unknown_format' ); return new $this->mFormats[$format] ($this, $format); } -- 2.20.1