On Sun, Nov 16, 2008 at 11:52 PM, Sandro Noel <[EMAIL PROTECTED]> wrote:
> as it turns out. with the bug fixed the mounts array is left null because
> the file does not exist yet.
> so further in the program is i try to add to the array, nothing happens.
>
> and if i try "mounts = [[NSMutableArray alloc] init];" only the two arrays
> get the same pointer.

Well, then what's happening is obvious. initWithContentsOfFile: fails
because the file doesn't exist, so it performs cleanup (aka, call
release) and returns null. Your next alloc then just happens to grab
the same memory block. So two things to learn from this:

1) never call the init* methods twice on the same object.
2) always use the value returned from an init* method.
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to