This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 2746a2850b93d48ade12e9b970dbecf4ad4c8b9f
Author: Alex Harui <aha...@apache.org>
AuthorDate: Tue Nov 27 09:54:33 2018 -0800

    XML.normalize was deleting the wrong node if there was two consecutive 
empty text nodes, which can happen if a non-text node is commented out.  The 
commented out node will be removed elsewhere leave the two text nodes next to 
each other.  But if the text nodes are empty they are removed, so lastChild 
should not point to a removed text node, otherwise it will try to 
deleteChildAt(i+1) which can be the last valid non-text node.  I also took out 
the range checking on deleteChildAt since, [...]
---
 frameworks/projects/XML/src/main/royale/XML.as | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/frameworks/projects/XML/src/main/royale/XML.as 
b/frameworks/projects/XML/src/main/royale/XML.as
index 5edda60..fedf1be 100644
--- a/frameworks/projects/XML/src/main/royale/XML.as
+++ b/frameworks/projects/XML/src/main/royale/XML.as
@@ -904,10 +904,6 @@ package
 
                private function deleteChildAt(idx:int):void
                {
-                       if(idx < 0)
-                               return;
-                       if(idx >= childrenLength())
-                               return;
                        var child:XML = _children[idx];
                        child._parent = null;
                        _children.splice(idx,1);
@@ -1569,7 +1565,10 @@ package
                                                deleteChildAt(i+1);
                                        }
                                        if(!child.s())
+                    {
                                                deleteChildAt(i);
+                        continue; //don't set last child if we removed it
+                    }
                                }
                                lastChild = child;
                        }

Reply via email to