[MediaWiki-commits] [Gerrit] mediawiki...cxserver[master]: MWImage: Fix js error when textchunk is \n with no tags

2017-10-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/381949 )

Change subject: MWImage: Fix js error when textchunk is \n with no tags
..


MWImage: Fix js error when textchunk is \n with no tags

Add a check for tags array before accessing.

Can be tested using the bin/adapt utility and the following html





caption


Change-Id: I1f31ccfe940725bd9cde0d990df3851ad0a9eb15
---
M lib/translationunits/MWImage.js
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Nikerabbit: Looks good to me, approved



diff --git a/lib/translationunits/MWImage.js b/lib/translationunits/MWImage.js
index 1d7dce9..d99903a 100644
--- a/lib/translationunits/MWImage.js
+++ b/lib/translationunits/MWImage.js
@@ -56,7 +56,7 @@
 
for ( i = 0, len = this.node.children.textChunks.length; i < len; i++ ) 
{
chunk = this.node.children.textChunks[ i ];
-   if ( chunk.tags[ 0 ].name === 'a' ) {
+   if ( chunk.tags[ 0 ] && chunk.tags[ 0 ].name === 'a' ) {
imageLink = chunk.tags[ 0 ];
}
if ( chunk.inlineContent && chunk.inlineContent.name === 'img' 
) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1f31ccfe940725bd9cde0d990df3851ad0a9eb15
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 
Gerrit-Reviewer: Nikerabbit 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...cxserver[master]: MWImage: Fix js error when textchunk is \n with no tags

2017-10-03 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/381949 )

Change subject: MWImage: Fix js error when textchunk is \n with no tags
..

MWImage: Fix js error when textchunk is \n with no tags

Add a check for tags array before accessing.

Can be tested using the bin/adapt utility and the following html





caption


Change-Id: I1f31ccfe940725bd9cde0d990df3851ad0a9eb15
---
M lib/translationunits/MWImage.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/49/381949/1

diff --git a/lib/translationunits/MWImage.js b/lib/translationunits/MWImage.js
index 1d7dce9..d99903a 100644
--- a/lib/translationunits/MWImage.js
+++ b/lib/translationunits/MWImage.js
@@ -56,7 +56,7 @@
 
for ( i = 0, len = this.node.children.textChunks.length; i < len; i++ ) 
{
chunk = this.node.children.textChunks[ i ];
-   if ( chunk.tags[ 0 ].name === 'a' ) {
+   if ( chunk.tags[ 0 ] && chunk.tags[ 0 ].name === 'a' ) {
imageLink = chunk.tags[ 0 ];
}
if ( chunk.inlineContent && chunk.inlineContent.name === 'img' 
) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f31ccfe940725bd9cde0d990df3851ad0a9eb15
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

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