Do a last check before creating the object to not throw a fatal error when calling...
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index 1fc65f3..35c1426 100644 (file)
@@ -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);
        }