]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListViewModel.java
two NPE fixed
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / transaction_list / TransactionListViewModel.java
index 3693a1491fef4a27fd00411cd43fa02c69ba447f..d391b6227b5674019a853609cad9802f72330204 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2018 Damyan Ivanov.
+ * Copyright © 2019 Damyan Ivanov.
  * This file is part of Mobile-Ledger.
  * Mobile-Ledger is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -27,7 +27,7 @@ import net.ktnx.mobileledger.R;
 import net.ktnx.mobileledger.async.UpdateTransactionsTask;
 import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.LedgerTransaction;
-import net.ktnx.mobileledger.model.ObservableValue;
+import net.ktnx.mobileledger.utils.ObservableValue;
 
 import java.util.List;
 
@@ -35,9 +35,9 @@ public class TransactionListViewModel extends ViewModel {
     public static ObservableValue<Boolean> updating = new ObservableValue<>();
 
     public static void scheduleTransactionListReload(Activity act) {
-        boolean hasFilter =
-                act.findViewById(R.id.transaction_list_account_name_filter).getVisibility() ==
-                View.VISIBLE;
+        View filter = act.findViewById(R.id.transaction_list_account_name_filter);
+        if (filter == null) return;
+        boolean hasFilter = filter.getVisibility() == View.VISIBLE;
         String accFilter = hasFilter ? String.valueOf(
                 ((AutoCompleteTextView) act.findViewById(R.id.transaction_filter_account_name))
                         .getText()) : null;