Hi,

I'm new to objective-C so this might be elementary for some, but I can't seem to figure out why this is happening.

Here's two code samples:

ONE:
SpectralData* spectrum = [selectedLightSource spectralPowerDistribution];
    NSMutableArray* lightSourceData1 = [spectrum data];

TWO:
NSMutableArray* lightSourceData2 = [[selectedLightSource spectralPowerDistribution] data];

If my understanding of objective-C is correct, the second one is just a short version of writing the first. But the first one works fine and the second one causes an NSRangeException:

An uncaught exception was raised
*** -[NSCFArray objectAtIndex:]: index (-1877845435( or possibly larger)) beyond bounds (41) *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (-1877845435( or possibly larger)) beyond bounds (41)'


Both get properties, 'spectralPowerDistribution' and 'data' are really simple. They just return the member variables of type SpectralData* and NSMutableArray* respectively.

Any ideas?

Thanks!
Vin

_______________________________________________

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