two NPE fixed
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 9 Jan 2019 20:18:15 +0000 (20:18 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 9 Jan 2019 20:18:15 +0000 (20:18 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListViewModel.java
app/src/main/res/menu/transaction_list.xml

index 299fcbb8f17d0a565336ab96efcd780c7a03b965..d391b6227b5674019a853609cad9802f72330204 100644 (file)
@@ -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;
index 80232e4ae37767e4b249eb561495fad1b4fe8dab..b74b09a22f058af55397f90d2dd3e273d80f8c14 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-  ~ 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
@@ -24,7 +24,6 @@
         tools:context="net.ktnx.mobileledger.ui.activity.MainActivity"
         android:id="@+id/menu_transaction_list_filter"
         android:icon="@drawable/ic_filter_list_white_24dp"
-        android:onClick="onOptionsMenuClicked"
         android:title="Filter"
         app:showAsAction="always" />
 </menu>
\ No newline at end of file