Hi Piotr,

I'm wondering why some other code called getElementAt with an invalid
index.  Do we really need defensive code like this?

Thanks,
-Alex

On 4/2/17, 1:54 PM, "pio...@apache.org" <pio...@apache.org> wrote:

>Repository: flex-asjs
>Updated Branches:
>  refs/heads/feature/chart-work de48d638e -> 3d92c1c3a
>
>
>Method getElementAt should return null if element not exists on JS sight
>
>
>Project: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%7C01%7C%7Cfc958bcc743
>74f70c62908d47a0a81a6%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6362676
>32925352663&sdata=FgOBYzB84GNwYjkWLfiPSD%2BqaNm5%2F88apiCeRfspZXg%3D&reser
>ved=0
>Commit: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%2F3d92c1c3&data=02%7C01%7C%
>7Cfc958bcc74374f70c62908d47a0a81a6%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%
>7C0%7C636267632925352663&sdata=tuMQ8oYjITRbU8IyzWziiyeAtEE6vVL%2BFPU3Ss44V
>S8%3D&reserved=0
>Tree: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F3d92c1c3&data=02%7C01%7C%7C
>fc958bcc74374f70c62908d47a0a81a6%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>0%7C636267632925352663&sdata=acLn0k3uWpk1mkvNdMx1JAWegpED2Aavi7ThgCGIrQk%3
>D&reserved=0
>Diff: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F3d92c1c3&data=02%7C01%7C%7C
>fc958bcc74374f70c62908d47a0a81a6%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>0%7C636267632925352663&sdata=E9vx%2FXFguS2mVzIm98MHBjKQLgTJ0Om61qiaG8C10%2
>FI%3D&reserved=0
>
>Branch: refs/heads/feature/chart-work
>Commit: 3d92c1c3a79f5a334d008f1b54d3b53048a93465
>Parents: de48d63
>Author: piotrz <pio...@apache.org>
>Authored: Sun Apr 2 22:54:45 2017 +0200
>Committer: piotrz <pio...@apache.org>
>Committed: Sun Apr 2 22:54:45 2017 +0200
>
>----------------------------------------------------------------------
> .../projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as  | 5 +++++
> 1 file changed, 5 insertions(+)
>----------------------------------------------------------------------
>
>
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F3d92c1c3%2Fframeworks%2Fpro
>jects%2FHTML%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%2Fcore%2FUIBase.as&
>data=02%7C01%7C%7Cfc958bcc74374f70c62908d47a0a81a6%7Cfa7b1b5a7b34438794aed
>2c178decee1%7C0%7C0%7C636267632925352663&sdata=oFj070ssakLLA%2FySQo0DSHQEi
>%2B3gXO%2BM5XEsJk%2BTsc4%3D&reserved=0
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
>b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
>index af9e255..ad4f999 100644
>--- 
>a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
>+++ 
>b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
>@@ -1087,6 +1087,11 @@ package org.apache.flex.core
>             COMPILE::JS
>             {
>                 var children:Array = internalChildren();
>+                if (children.length == 0)
>+                {
>+                    return null;
>+                }
>+
>                 return children[index].flexjs_wrapper;
>             }
>         }        
>

Reply via email to