FWIW, I was thinking that this kind of check should be replaced by some
capability in the tool chain to verify a configuration, maybe by marking
some values as required.  In production, you hopefully don't need these
kinds of checks.  I've also floated the idea of "debug-mode" beads which
have more checks than production beads.

Thoughts?
-Alex

On 11/7/13 11:36 AM, "[email protected]" <[email protected]> wrote:

>If bead value is not found, prevent set states from blowing up.
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/425d9613
>Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/425d9613
>Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/425d9613
>
>Branch: refs/heads/develop
>Commit: 425d9613964db13b09d6d80ee1a8d332cf0dcb2c
>Parents: 74c50e4
>Author: Om <[email protected]>
>Authored: Thu Nov 7 11:16:59 2013 -0800
>Committer: Om <[email protected]>
>Committed: Thu Nov 7 11:34:41 2013 -0800
>
>----------------------------------------------------------------------
> frameworks/as/src/org/apache/flex/core/ViewBase.as | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/425d9613/frameworks/
>as/src/org/apache/flex/core/ViewBase.as
>----------------------------------------------------------------------
>diff --git a/frameworks/as/src/org/apache/flex/core/ViewBase.as
>b/frameworks/as/src/org/apache/flex/core/ViewBase.as
>index 4e923a1..afeb04d 100644
>--- a/frameworks/as/src/org/apache/flex/core/ViewBase.as
>+++ b/frameworks/as/src/org/apache/flex/core/ViewBase.as
>@@ -81,8 +81,15 @@ package org.apache.flex.core
>         public function set states(value:Array):void
>         {
>             _states = value;
>-            if (getBeadByType(IStatesImpl) == null)
>-                addBead(new (ValuesManager.valuesImpl.getValue(this,
>"iStatesImpl")) as IBead);
>+                      try{
>+                              if (getBeadByType(IStatesImpl) == null)
>+                                      addBead(new 
>(ValuesManager.valuesImpl.getValue(this,
>"iStatesImpl")) as IBead);
>+                      }
>+                      //TODO:  Need to handle this case more gracefully
>+                      catch(e:Error)
>+                      {
>+                              trace(e.message);
>+                      }
>             
>         }
>         
>

Reply via email to