Nikerabbit has uploaded a new change for review. https://gerrit.wikimedia.org/r/89632
Change subject: Handle null message content gracefully ...................................................................... Handle null message content gracefully This skips messages for which we fail to load any content. This avoids null messages showing up in Special:TranslationStash. Change-Id: I019e6635726f06f6c1bf1de1ccaf977b587ce44e --- M messagegroups/SandboxMessageGroup.php 1 file changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/32/89632/1 diff --git a/messagegroups/SandboxMessageGroup.php b/messagegroups/SandboxMessageGroup.php index d54c573..76f5a02 100644 --- a/messagegroups/SandboxMessageGroup.php +++ b/messagegroups/SandboxMessageGroup.php @@ -100,17 +100,27 @@ $title = Title::makeTitle( $ns, "$page/{$this->language}" ); $handle = new MessageHandle( $title ); + if ( MessageGroups::isTranslatableMessage( $handle ) ) { - $count++; + // Modified by reference $translation = $this->getMessageContent( $handle ); + if ( $translation === null ) { + // Something is not in sync or badly broken. Handle gracefully. + unset( $list[$index] ); + wfWarn( "No message definition for $index while preparing sanbox" ); + continue; + } } else { // This might include messages that the user has already translated // or messages given in $wgTranslateSandboxSuggestions or just dated // message index. unset( $list[$index] ); wfWarn( "Unsuitable or unknown message $index while preparing sanbox" ); + continue; } + $count++; + // Always show 20 messages (or less in rare cases) if ( $count === 20 ) { break; -- To view, visit https://gerrit.wikimedia.org/r/89632 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I019e6635726f06f6c1bf1de1ccaf977b587ce44e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits