开发者

Can someone explain "Dereference of a null pointer" warning

I've written a couple of apps which work and seem bug free (ie, they don't crash...) but I get warnings for the code below (which I use a few times) -

In the @interface -

GameViewController *controller;

In the @implementation -

-(id)initWithOwner:(GameViewController *)aController withName:(NSString *)manName {

if (self = [super init]) {
    // do stuff
}

controller = aController;

On that last line, it says开发者_运维知识库 "Dereference of a null pointer". I'm fairly new to Objective-C (and C as well) so I haven't a clue what it means. Any help & explanation appreciated!


Sorry folks - I've found out the problem, after a bit more research. Obviously (at least it's obvious now!) self could end up as nil - see this post: Dereference of Null Pointer

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜