This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes iOS and the fly likes Error because of null pointer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Error because of null pointer" Watch "Error because of null pointer" New topic
Author

Error because of null pointer

Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Hi

I am getting the EXC_BAD_ACCESS error when I execute this code.


I think that the square object is collected so I am getting this error.
Is there any solution for this?
Thanks in advance.

Himanshu

My Blog SCJP 5 SCWCD 5
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I don't see square defined as a property. It looks to me like it isn't there. Maybe you have it in your interface .h file.

Anyway, if you do have it there, I don't see anywhere where square gets initialized/instantiated to actually refer to any object. So to me that means it starts off null in the beginning.

Maybe I am missing something here, but that seems to be the problem.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

It was because of improper population of the array elements.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error because of null pointer
 
Similar Threads
How do I convert a list of list into array [] []
Applet notinited
array of array help
Dead Code on return statement
Connect-four