Skip to content

Commit 578ced9

Browse files
author
irgendeinich
committed
Add null check for arguments
1 parent f741971 commit 578ced9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

android/src/main/java/com/pspdfkit/views/PdfView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ public void setMenuItemGroupingRule(@NonNull MenuItemGroupingRule groupingRule)
248248
private void setupFragment() {
249249
if (fragmentTag != null && configuration != null && document != null) {
250250
PdfFragment pdfFragment = (PdfFragment) fragmentManager.findFragmentByTag(fragmentTag);
251-
if (pdfFragment != null && pdfFragment.getArguments().getInt(ARG_ROOT_ID) != internalId) {
251+
if (pdfFragment != null &&
252+
(pdfFragment.getArguments() == null ||
253+
pdfFragment.getArguments().getInt(ARG_ROOT_ID) != internalId)) {
252254
// This is an orphaned fragment probably from a reload, get rid of it.
253255
fragmentManager.beginTransaction()
254256
.remove(pdfFragment)

0 commit comments

Comments
 (0)