Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/204500

Change subject: Avoid a js error in postMT handler of translations module
......................................................................

Avoid a js error in postMT handler of translations module

Change-Id: I3c9a946419f06a71c33232cfce84041ac25f17e4
---
M modules/translation/ext.cx.translation.js
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/00/204500/1

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 67d71a8..b76b0b3 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -166,9 +166,16 @@
         * @param {jQuery} $section
         */
        ContentTranslationEditor.prototype.postProcessMT = function ( $section 
) {
-               var selection,
-                       $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
+               var selection, $sourceSection;
 
+               if ( !$section || !$section.length ) {
+                       // Empty references in some articles cause this.
+                       // Example: See Notes section in
+                       // 
https://fr.wikipedia.org/w/index.php?title=Dong_Qichang&oldid=100845438
+                       return;
+               }
+
+               $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
                mw.hook( 'mw.cx.translation.change' ).fire( $section );
                mw.hook( 'mw.cx.translation.focus' ).fire( $section );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/204500
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c9a946419f06a71c33232cfce84041ac25f17e4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to