You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2018/12/26 09:04:20 UTC

[royale-asjs] branch develop updated: Using nested state causes parent to be null in some cases, added null check to prevent exception. (#357)

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new eb1bcbb  Using nested state causes parent to be null in some cases, added null check to prevent exception. (#357)
eb1bcbb is described below

commit eb1bcbb0bd74b0cd4566ee36b3895d97626ebc4a
Author: likyateknoloji <bi...@likyateknoloji.com>
AuthorDate: Wed Dec 26 12:04:16 2018 +0300

    Using nested state causes parent to be null in some cases, added null check to prevent exception. (#357)
---
 .../org/apache/royale/core/StatesWithTransitionsImpl.as     | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/frameworks/projects/Effects/src/main/royale/org/apache/royale/core/StatesWithTransitionsImpl.as b/frameworks/projects/Effects/src/main/royale/org/apache/royale/core/StatesWithTransitionsImpl.as
index fb09826..f00448a 100644
--- a/frameworks/projects/Effects/src/main/royale/org/apache/royale/core/StatesWithTransitionsImpl.as
+++ b/frameworks/projects/Effects/src/main/royale/org/apache/royale/core/StatesWithTransitionsImpl.as
@@ -321,11 +321,14 @@ package org.apache.royale.core
                                 var child:IChild = ai.document[ai.relativeTo] as IChild;
                                 if (ai.destination == null)
                                     parent = child.parent as IParent;
-                                var index:int = parent.getElementIndex(child);
-                                if (ai.position == "after")
-                                    index++;
-                                parent.addElementAt(item, index);
-                                childrenAdded = true;
+								if(parent != null) 
+								{
+	                                var index:int = parent.getElementIndex(child);
+	                                if (ai.position == "after")
+	                                    index++;
+	                                parent.addElementAt(item, index);
+	                                childrenAdded = true;
+								}
                             }
                             else
                             {