From 0d951424437fcff24abadc960a419a5ca034019a Mon Sep 17 00:00:00 2001 From: sgong-pdftron Date: Mon, 31 Mar 2025 13:45:30 -0700 Subject: [PATCH 1/3] Fix NPE on mTempFiles --- .../pdftron/reactnative/views/DocumentView.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/android/src/main/java/com/pdftron/reactnative/views/DocumentView.java b/android/src/main/java/com/pdftron/reactnative/views/DocumentView.java index 93aa999c..04111414 100644 --- a/android/src/main/java/com/pdftron/reactnative/views/DocumentView.java +++ b/android/src/main/java/com/pdftron/reactnative/views/DocumentView.java @@ -131,7 +131,7 @@ public class DocumentView extends com.pdftron.pdf.controls.DocumentView2 { private String mBase64Extension = ".pdf"; private String mDocumentExtension; - private ArrayList mTempFiles = new ArrayList<>(); + private final ArrayList mTempFiles = new ArrayList<>(); private FragmentManager mFragmentManagerSave; // used to deal with lifecycle issue @@ -139,8 +139,8 @@ public class DocumentView extends com.pdftron.pdf.controls.DocumentView2 { private ToolManagerBuilder mToolManagerBuilder; private ViewerConfig.Builder mBuilder; - private ArrayList mDisabledTools = new ArrayList<>(); - private ArrayList mDisabledButtonTypes = new ArrayList<>(); // used to disabled button types that are with specific a with explicit tool type (e.g. checkmark, dot, cross stamps) + private final ArrayList mDisabledTools = new ArrayList<>(); + private final ArrayList mDisabledButtonTypes = new ArrayList<>(); // used to disabled button types that are with specific a with explicit tool type (e.g. checkmark, dot, cross stamps) private String mExportPath; private String mOpenUrlPath; @@ -2347,14 +2347,12 @@ protected void onDetachedFromWindow() { getViewTreeObserver().removeOnGlobalLayoutListener(mOnGlobalLayoutListener); - if (mTempFiles != null) { - for (File file : mTempFiles) { - if (file != null && file.exists()) { - file.delete(); - } + for (File file : mTempFiles) { + if (file != null && file.exists()) { + file.delete(); } - mTempFiles = null; } + mTempFiles.clear(); } public void onActivityResult(int requestCode, int resultCode, Intent data) { From 2cc8c7fdb1a2e93252a1cfd171e09bc5a8cfa8d1 Mon Sep 17 00:00:00 2001 From: sgong-pdftron Date: Mon, 31 Mar 2025 13:50:43 -0700 Subject: [PATCH 2/3] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9623a7b6..a6d2f005 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-pdftron", "title": "React Native Pdftron", - "version": "3.0.4-13", + "version": "3.0.4-14", "description": "React Native Pdftron", "main": "./lib/index.js", "typings": "index.ts", From 78edcdb0d3c0c86c7c5d478698269c1f7301c23c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 20:22:27 +0000 Subject: [PATCH 3/3] Updating package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b42c5c87..e0da4a16 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-pdftron", "title": "React Native Pdftron", - "version": "3.0.4-14", + "version": "3.0.4-15", "description": "React Native Pdftron", "main": "./lib/index.js", "typings": "index.ts",