diff --git a/api/ParserService.js b/api/ParserService.js
index fa3c570c87..19be682658 100644
--- a/api/ParserService.js
+++ b/api/ParserService.js
@@ -264,6 +264,9 @@ var roundTripDiff = function ( req, res, src, document ) {
res.write(document.body.innerHTML + '
');
res.write( 'HTML DOM converted back to Wikitext
' );
var out = new WikitextSerializer({env: env}).serializeDOM( document.body );
+ if ( out === undefined ) {
+ out = "An error occured in the WikitextSerializer, please check the log for information";
+ }
res.write('' + htmlSpecialChars( out ) + '
\n');
res.write( 'Diff between original Wikitext (green) and round-tripped wikitext (red)
\n' );
var patch;