Content deleted Content added
RProgrammer (talk | contribs) m If windows("Main") is null, .views() will be called on null--better just to be general I expect :3 |
RProgrammer (talk | contribs) m →Object property dereferencing: idk, clearer; minor edit |
||
Line 13:
first looks in the array of windows for a window with the name "Main", gets the 5th subview within it, then calls the <code>size</code> method to return a structure with the view's dimensions, and finally calls the <code>width</code> method on that structure to produce a result that is assigned to <code>theWidth</code>.
The problem with this approach is that the code assumes that all of these values exist. While it is reasonable to
To avoid this error, the programmer has to check every method call to ensure it returns a value. A safer version of the same code would be:
|