From 7086582fad10a8c9f85ccf8f84a2e6bf1d44f379 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 01:56:57 +0900 Subject: [PATCH] =?UTF-8?q?getItemCount=E3=81=A7=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=B3=E3=82=B9=E5=A4=89=E6=95=B0=E3=81=AE?= =?UTF-8?q?=E4=B8=AD=E8=BA=AB=E3=82=92=E8=BB=BD=E3=81=8F=E3=83=81=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/component/viewer/ViewerViewPagerAdapter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java index 3c91cde5..b6db3f6d 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java @@ -34,7 +34,13 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter { @Override public int getItemCount() { - return fragmentTargetIdList == null ? 0 : fragmentTargetIdList.size(); + if (fragmentTargetIdList == null || fragmentTitleList == null) { + return 0; + } else if (fragmentTargetIdList.size() != fragmentTitleList.size()) { + throw new IllegalStateException("fragmentTargetIdList.size() != fragmentTitleList.size()"); + } else { + return fragmentTargetIdList.size(); + } } @Nullable