From 9e8b945f04e3a0f1d99141ed87278dde22fe0b46 Mon Sep 17 00:00:00 2001 From: liujuan Date: Sat, 1 Jun 2024 03:14:15 +0000 Subject: [PATCH] update product/phone/src/main/ets/view/PhotoBrowserComponent.ets. Signed-off-by: liujuan --- .../phone/src/main/ets/view/PhotoBrowserComponent.ets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/product/phone/src/main/ets/view/PhotoBrowserComponent.ets b/product/phone/src/main/ets/view/PhotoBrowserComponent.ets index 7925cd1d..5af27b2d 100644 --- a/product/phone/src/main/ets/view/PhotoBrowserComponent.ets +++ b/product/phone/src/main/ets/view/PhotoBrowserComponent.ets @@ -438,11 +438,11 @@ export struct PhotoBrowserComponent { if (currentPhoto == undefined || this.isFromViewDataWithThirdUri) { return; } - this.photoDate = DateUtil.getLocalizedDate(currentPhoto.getDataTaken()); + this.photoDate = DateUtil.getLocalizedDate(currentPhoto?.getDataTaken()); if (this.pageFrom == Constants.ENTRY_FROM.DISTRIBUTED) { - this.timeAndLocation = `${this.deviceName}/${DateUtil.getLocalizedTime(currentPhoto.getDataTaken())}`; + this.timeAndLocation = `${this.deviceName}/${DateUtil.getLocalizedTime(currentPhoto?.getDataTaken())}`; } else { - this.timeAndLocation = DateUtil.getLocalizedTime(currentPhoto.getDataTaken()); + this.timeAndLocation = DateUtil.getLocalizedTime(currentPhoto?.getDataTaken()); } this.updateMenu(index); } @@ -561,11 +561,11 @@ export struct PhotoBrowserComponent { } getCurrentPhoto(): MediaItem { - return this.dataSource.getRawData(this.currentIndex).data; + return this.dataSource?.getRawData(this.currentIndex).data; } getPhotoByIndex(index: number): MediaItem { - return this.dataSource.getRawData(index).data; + return this.dataSource?.getRawData(index).data; } async onMoveEnd(err: Object, count: number, total: number): Promise {