]> git.ktnx.net Git - mobile-ledger.git/commitdiff
move null check before the value is used
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 2 May 2019 15:16:19 +0000 (18:16 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 3 May 2019 15:17:59 +0000 (18:17 +0300)
app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListViewModel.java

index e88481cfba902de387b9f005b25b8b31b708fcf0..bd53c2d812e99de09e9c829044bbf49b4aa957f6 100644 (file)
@@ -39,8 +39,8 @@ public class TransactionListViewModel extends ViewModel {
         task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, filter);
     }
     public static TransactionListItem getTransactionListItem(int position) {
+        if (Data.transactions == null) return null;
         try(LockHolder lh = Data.transactions.lockForReading()) {
-            if (Data.transactions == null) return null;
             if (position >= Data.transactions.size() + 1) return null;
             if (position == Data.transactions.size()) return new TransactionListItem();
             return Data.transactions.get(position);