Fix non-file page edit error

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2024-10-23 21:01:32 -07:00
parent a80e422874
commit f498cef9a5

View File

@@ -43,7 +43,7 @@ class GlModelViewer extends ImageHandler {
public static function onAlternateEditPreview( EditPage $editor, Content $content, string &$previewHTML, ?ParserOutput &$parserOutput ) { public static function onAlternateEditPreview( EditPage $editor, Content $content, string &$previewHTML, ?ParserOutput &$parserOutput ) {
$file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($editor->getTitle()); $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($editor->getTitle());
if ($file->getMimeType() !== 'model/gltf-binary') { if (!$file || $file->getMimeType() !== 'model/gltf-binary') {
return true; return true;
} }
$out = $editor->getContext()->getOutput(); $out = $editor->getContext()->getOutput();