之前项目是1.6没有问题,升级成1.8后有一定概率出现黑屏
出错堆栈如下
JSException
Uncaught TypeError: Cannot read property ‘_activeInHierarchy’ of null
1 [0]s@src/jsb_polyfill.js:6619
2 [1]cancelInactive@src/jsb_polyfill.js:6680
3 [2]activateNode@src/jsb_polyfill.js:14829
4 [3]set@src/jsb_polyfill.js:19915
5 [4]update@src/project.js:5507
6 [5]anonymous@(no filename):3
7 [6]invoke@src/jsb_polyfill.js:6718
8 [7]updatePhase@src/jsb_polyfill.js:6791
9 [8]callback@src/jsb_polyfill.js:27403
对应的原始代码是,加粗的是出错的代码
update: function (dt) {
this._endTime += dt;
if (this._endTime >= 1) {
this._endTime = 0;
var xinhao = this._status.getChildByName(‘xinhao’);
var xinhaoIndex = 3;
for (var i = 0; i < xinhao.children.length; ++i) {
xinhao.children[i].active = false;
}
if (cc.vv.net.delayMS != null) {
if (cc.vv.net.delayMS > 500) {
xinhaoIndex = 2;
}
else if (cc.vv.net.delayMS > 100) {
xinhaoIndex = 1;
}
else {
xinhaoIndex = 0;
}
}
xinhao.children[xinhaoIndex].active = true;
var power = this._status.getChildByName('power');
power.scaleX = cc.vv.anysdkMgr.getBatteryPercent();
}
