!516 【master】【RK3568】【压力测试】【ToC】【高概率】【wukong】出现33次 进程com.ohos.photos下出现jscrash,栈名:initializeConsume/getCountOfMedia

Merge pull request !516 from liujuan/master
This commit is contained in:
openharmony_ci 2024-02-27 12:22:34 +00:00 committed by Gitee
commit 6f7c8f68fc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -35,34 +35,34 @@ export class SelectUtil {
static getCountOfMedia(uriArray: Array<string>, selectedMap: Map<string, MediaItem>): Promise<Array<number>> {
let result = [0, 0];
if (uriArray === undefined || uriArray.length <= 0) {
if (uriArray === null || uriArray === undefined || uriArray.length <= 0) {
Log.info(TAG, 'uriArray is null or empty!');
return new Promise((resolve) => {
return new Promise((resolve): void => {
resolve(result);
})
});
}
if (selectedMap === undefined || selectedMap.size <= 0) {
Log.info(TAG, 'selectedMap is null or empty!');
return new Promise((resolve) => {
return new Promise((resolve): void => {
resolve(result);
})
});
}
let imageCount: number = 0;
let videoCount: number = 0;
for (let i = 0; i < selectedMap.size; i++) {
for (let i = 0; i < uriArray.length; i++) {
let mediaItem: MediaItem = selectedMap.get(uriArray[i]);
if (mediaItem.mediaType === UserFileManagerAccess.MEDIA_TYPE_IMAGE) {
if (mediaItem?.mediaType === UserFileManagerAccess.MEDIA_TYPE_IMAGE) {
imageCount++;
} else if (mediaItem.mediaType === UserFileManagerAccess.MEDIA_TYPE_VIDEO) {
} else if (mediaItem?.mediaType === UserFileManagerAccess.MEDIA_TYPE_VIDEO) {
videoCount++;
}
}
result = [imageCount, videoCount];
return new Promise((resolve) => {
return new Promise((resolve): void => {
resolve(result);
})
});
}
static async grantPermissionForUris(uris: Array<string>, bundleName: string): Promise<void> {