From fbd758140b79667489261eb9f0e4dbce0cacba34 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 16 Feb 2016 07:21:14 +0100 Subject: [PATCH] Prevent crash Refs #291 --- .../java/eu/faircode/netguard/ActivityMain.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/ActivityMain.java b/app/src/main/java/eu/faircode/netguard/ActivityMain.java index 3eb02f9e..4d978b5c 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivityMain.java +++ b/app/src/main/java/eu/faircode/netguard/ActivityMain.java @@ -512,13 +512,15 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences if (adapter != null) { adapter.set(result); - SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuSearch); - if (search == null) { - if (menuSearch != null && menuSearch.isActionViewExpanded()) - adapter.getFilter().filter(searchView.getQuery().toString()); - } else { - MenuItemCompat.expandActionView(menuSearch); - searchView.setQuery(search, true); + if (menuSearch != null) { + SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuSearch); + if (search == null) { + if (menuSearch.isActionViewExpanded()) + adapter.getFilter().filter(searchView.getQuery().toString()); + } else { + MenuItemCompat.expandActionView(menuSearch); + searchView.setQuery(search, true); + } } }