1.fix 当loadSrc参数传入为undefined时,由于对undefined数据进行读取属性导致的crash问题

Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
zhoulisheng1 2023-03-23 17:49:36 +08:00
parent 2f9c38c14f
commit 065abc6686
1 changed files with 6 additions and 0 deletions

View File

@ -251,6 +251,11 @@ export struct ImageKnifeComponent {
}
// imageknife 第一次启动和数据刷新后重新发送请求
imageKnifeExecute() {
if(this.imageKnifeOption.loadSrc == null){
// 如果数据是null或者undefined 则不进入图片请求流程
return
}
this.resetGifData()
let request = new RequestOption();
this.configNecessary(request);
@ -624,6 +629,7 @@ export struct ImageKnifeComponent {
if (index >= frames.length) {
index = 0;
}
// @ts-ignore
this.gifTimerId = setTimeout(this.renderFrames.bind(this, frames, index, context, compWidth, compHeight), delayTime)
}
}