List的touchItem报错问题

list滑动的时候好像会触发touchItem, 代码中

public GObject touchItem
{
get
{
//find out which item is under finger
//逐层往上知道查到点击了那个item
GObject obj = GRoot.inst.touchTarget;
GObject p = obj.parent;
while (p != null)
{
if (p == this)
return obj;

obj = p;
p = p.parent;
}

return null;
}
}

GObject p = obj.parent 会报空引用异常,应该是无obj,不清楚具体原因。。求谷主解答。。Unity + tolua#
已邀请:

谷主

赞同来自:

list滑动时不会触发touchItem

MeLwh

赞同来自:

但是点击报错这个原因。。要怎么查呢,这种低概率偶发的BUG 没有头绪

要回复问题请先登录注册