]> git.ktnx.net Git - mobile-ledger.git/commitdiff
emplye requireNonNull instead of a manual check
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 24 Sep 2020 16:11:27 +0000 (16:11 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 24 Sep 2020 16:11:38 +0000 (16:11 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java

index 46a0ea6e6abbe7dcd3c9dca6e24e81f5db89f4a9..ec3ed661966466c77e356b68cd369b5c4354747f 100644 (file)
@@ -61,6 +61,7 @@ import org.jetbrains.annotations.NotNull;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Objects;
 import java.util.UUID;
 
 import static net.ktnx.mobileledger.utils.Logger.debug;
@@ -157,9 +158,8 @@ public class ProfileDetailFragment extends Fragment {
     private void triggerProfileChange() {
         int index = Data.getProfileIndex(mProfile);
         MobileLedgerProfile newProfile = new MobileLedgerProfile(mProfile);
-        final ArrayList<MobileLedgerProfile> profiles = Data.profiles.getValue();
-        if (profiles == null)
-            throw new AssertionError();
+        final ArrayList<MobileLedgerProfile> profiles =
+                Objects.requireNonNull(Data.profiles.getValue());
         profiles.set(index, newProfile);
 
         ProfilesRecyclerViewAdapter viewAdapter = ProfilesRecyclerViewAdapter.getInstance();