On 1 Dec 2012, at 4:13 PM, "jonat...@mugginsoft.com" <jonat...@mugginsoft.com> wrote:
> NSURL *scriptsFolderURL = [[NSFileManager defaultManager] ... > error:error]; > > if (*error) { > MLogInfo(@"Error: %@", *error); ... Stop. Go no further till you fix this. The return-by-reference NSError variable is NEVER, EVER* an indication that the call that returns it failed. The API does not guarantee (as you seem to assume) that *error will be nilled-out on success; in fact, the general rule kind of promises that it _won't_. It may still contain the garbage you passed in. It may be a scratch NSError object that the callee filled in as a contingency — so even if you nil-out *error yourself, it may be non-nil even if the method succeeded. * (I believe there are a couple of methods that do use the indirect NSError as the error indicator, but I've forgotten what they are, and they are mistakes.) The _only_ indication that a method failed is its principal return value. It that's nil (or 0, or NSNotFound, or NO, or whatever the API defines for that call), _then_ you can examine the error return. Check scriptsFolderURL == nil. By the way, apparently "error" came in as a parameter. You don't control whether it is NULL, which is legal under the coding standard for return-by-reference NSError. Don't dereference it until you know. I'm surprised that got past the analyzer (unless you assert it's nonnull earlier in the method). Amend your code and tell us how that affects the bug. — F _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com