From 0971617897ba014cdad7c88967bc3ff3a9a2fb70 Mon Sep 17 00:00:00 2001 From: guojin26 Date: Wed, 10 Nov 2021 14:07:43 +0800 Subject: [PATCH 1/2] modify null pointer Signed-off-by: guojin26 --- .../samples/distributedpictures/slice/MainAbilitySlice.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/DistributedPictures/entry/src/main/java/ohos/samples/distributedpictures/slice/MainAbilitySlice.java b/data/DistributedPictures/entry/src/main/java/ohos/samples/distributedpictures/slice/MainAbilitySlice.java index a6ec5cc358..eeb10db426 100644 --- a/data/DistributedPictures/entry/src/main/java/ohos/samples/distributedpictures/slice/MainAbilitySlice.java +++ b/data/DistributedPictures/entry/src/main/java/ohos/samples/distributedpictures/slice/MainAbilitySlice.java @@ -61,8 +61,10 @@ public class MainAbilitySlice extends AbilitySlice { } private void initDistributedFile() { - distributedFile = this.getDistributedDir().getPath() + "/icon.png"; - HiLog.info(LABEL_LOG, "%{public}s", "distributedFile :" + distributedFile); + if (this.getDistributedDir() != null) { + distributedFile = this.getDistributedDir().getPath() + "/icon.png"; + HiLog.info(LABEL_LOG, "%{public}s", "distributedFile :" + distributedFile); + } } private void initComponents() { -- Gitee From f857d7a19bf197e803c6273856b8566fa1c7eae5 Mon Sep 17 00:00:00 2001 From: guojin26 Date: Wed, 10 Nov 2021 14:09:03 +0800 Subject: [PATCH 2/2] update Signed-off-by: guojin26 --- .../samples/distributedpictures/slice/MainAbilitySlice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/DistributedPictures/entry/src/main/java/ohos/samples/distributedpictures/slice/MainAbilitySlice.java b/data/DistributedPictures/entry/src/main/java/ohos/samples/distributedpictures/slice/MainAbilitySlice.java index eeb10db426..c9f3736dfa 100644 --- a/data/DistributedPictures/entry/src/main/java/ohos/samples/distributedpictures/slice/MainAbilitySlice.java +++ b/data/DistributedPictures/entry/src/main/java/ohos/samples/distributedpictures/slice/MainAbilitySlice.java @@ -61,7 +61,7 @@ public class MainAbilitySlice extends AbilitySlice { } private void initDistributedFile() { - if (this.getDistributedDir() != null) { + if (this.getDistributedDir() != null) { distributedFile = this.getDistributedDir().getPath() + "/icon.png"; HiLog.info(LABEL_LOG, "%{public}s", "distributedFile :" + distributedFile); } -- Gitee