greg-dove commented on issue #185: URL: https://github.com/apache/royale-compiler/issues/185#issuecomment-864283655
> Oh, that's fantastic. I was going to report the null issue as well. It's another case where the exceptions seem to be swallowed and subsequent code fails to execute at runtime. I keep thinking bindings have been failing for weird reasons, when in fact, I am finding that non-caught and non-erroring NPEs are stopping execution without any warning or error. @brianraymes it was definitely a possibility. For iteration over royale collections-based ArrayList it should be null-safe, if you see examples where it is not, please create an issue and I will work to address it. The ArrayCollection example is different because the way the code output for the loop is generated is different. At some point I will investigate whether it makes sense to use the same approach as ArrayList, because at the moment the Royale (non-mx) ArrayList for-each iteration is objectively more robust in situations when the loop target is mutated (e.g. its length is reduced or increased, for example) inside the loop. Usually this does not happen inside the loop, but at the moment both XMLList iteration and mx ArrayCollection iteration rely on it **not** happening inside the loop in order to behave correctly. On that note, XMLList for-each iteration also probably does not yet survive a null loop target at this point. I will check this sometime in the next week and see if it needs the same treatment as Proxy-based (of which ArrayCollection is one example) classes. So this may not yet work (it may throw runtime error): ``` var myNullReference:XMLList = null; for each (var thing:XML in myNullReference) ``` In terms of bindings... bindings do often have phases where they can have errors during startup (and usually then succeed on future executions when there are no null safety related errors) and these startup attempts with errors are 'swallowed' so they should not stop execution. Generally with Royale there are less of these than was the case in Flex, but the intention is that the execution thread should still proceed. If you can create or share small examples where execution is stopping unexpectedly, I would be happy to look into those to try to figure that out. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
