From 7bbf7c6b683caa20fe306c3759d17f6a01e831d9 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 22 Oct 2015 13:42:19 -0700 Subject: [PATCH] Fix "Call to a member function getIsPreview() on a non-object (NULL)" Also, the isset() checked was backwards Bug: T116257 Change-Id: I419208bd9ad1a7a758bf9dbe0450020a9f14d39e --- MathTexvc.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/MathTexvc.php b/MathTexvc.php index 8bb547f..eec8869 100644 --- a/MathTexvc.php +++ b/MathTexvc.php @@ -390,12 +390,9 @@ class MathTexvc extends MathRenderer { public function getPng() { global $wgHooks; // Workaround for bugfix for Bug 56769 - if ( !isset( $wgHooks['ParserAfterParse']['FlushMathBackend'] ) ) { - // saves the PNG-file - $parser = new Parser(); - $text = ''; - $stripState = new StripState( '' ); - Hooks::run( 'ParserAfterParse', array( &$parser, &$text, &$stripState ) ); + if ( isset( $wgHooks['ParserAfterParse']['FlushMathBackend'] ) ) { + // XXX: save any pending files so the read below works + call_user_func( $wgHooks['ParserAfterParse']['FlushMathBackend'] ); } $backend = $this->getBackend(); return $backend->getFileContents(