Buggy code:
public class Launcher extends AppCompatActivity implements NavigationView . OnNavigationItemSelectedListener , PlaceDetailsFragment . OnPlaceDetailsFragmentInteractionListener , SelectionFragment . OnSelectionFragmentSelection , ToolbarUpdateListener , FavoriteFragment . OnFavoriteFragmentInteractionListener , PlacesListFragment . OnPlaceListFragmentSelection , RecentFragment . OnRecentFragmentInteractionListener , GoogleApiClient . ConnectionCallbacks , GoogleApiClient . OnConnectionFailedListener { private static final int LOCATION_REQUEST_CODE = 1 ; private final String TAG = getClass ( ) . getSimpleName ( ) ; private Location loc ; private LocationManager locationManager ; private GoogleApiClient mGoogleApiClient ; private NavigationView mNavigationView ; private boolean mIsCustomLocation ; private MenuItem mSearchMenu ; private MenuItem mSetLocationMenu ; private SearchView mSearchView ; private View mCustomLocationHolderView ; private TextView mCustomLocationTextView ; private Button mCustomLocationClearButton ; private String mSavedCurrentLocationLatitude ; private String mSavedCurrentLocationLongitude ; private static final int SEARCH_TYPE_PLACE = 1 ; private static final int SEARCH_TYPE_LOCATION = 2 ; private static final int SEARCH_TYPE_DEFAULT = Launcher . SEARCH_TYPE_PLACE ; private int mSearchType = Launcher . SEARCH_TYPE_DEFAULT ; private Result mSetCustomLocationCallback = new TransactionManager . Result ( ) { @ Override public void onError ( String errorMsg , String placeTag ) { } @ Override public void onGetPlaceDetails ( IPlaceDetails response , String placeTag ) { } } ; private LocationListener listener = new LocationListener ( ) { @ Override public void onLocationChanged ( Location location ) { } @ Override public void onStatusChanged ( String s , int i , Bundle bundle ) { } @ Override public void onProviderEnabled ( String s ) { } @ Override public void onProviderDisabled ( String s ) { } } ; @ Override protected void onDestroy ( ) { } private void validateLocation ( ) { } private void registerLocationUpdates ( ) { } private void initGoogleClient ( ) { } @ Override protected void onResume ( ) { } @ Override protected void onActivityResult ( int requestCode , int resultCode , Intent data ) { } @ Override protected void onCreate ( Bundle savedInstanceState ) { } public void clearCustomLocation ( View view ) { } private void updateFragment ( final Fragment fragment , final boolean first , boolean isBackStack ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public boolean onNavigationItemSelected ( MenuItem item ) { } @ Override public void OnSelectionFragmentSelection ( Bundle bundle ) { } private void launchPlaceListFragment ( Bundle bundle ) { } @ Override protected void onNewIntent ( Intent intent ) { } private void enableCustomLocation ( boolean result , IPlaceDetails response ) { } @ Override public void onConnected ( Bundle bundle ) { } @ Override public void onConnectionSuspended ( int i ) { } @ Override public void onConnectionFailed ( ConnectionResult connectionResult ) { } @ Override public void OnPlaceListFragmentSelection ( final PlaceInfo place ) { } @ Override public void handleFragmentSuicidal ( String tag ) { } @ Override public void onFragmentInteraction ( Uri uri ) { } @ Override public void onRecentViewClicked ( String placeId ) { } @ Override public void onFavoriteViewClicked ( final String placeId ) { } @ Override public void onMapsViewClicked ( Bundle bundle ) { } @ Override public void onNavigationEnabled ( final boolean visibility ) { } @ Override public void onSearchBarEnabled ( boolean visibility ) { if ( ( mSearchMenu ) != null ) { mSearchMenu . setVisible ( visibility ) ; } if ( ( mSetLocationMenu ) != null ) { mSetLocationMenu . setVisible ( visibility ) ; if ( mIsCustomLocation ) { if ( visibility ) { TransactionManager . getInstance ( ) . addResultCallback ( mSetCustomLocationCallback ) ; } else { TransactionManager . getInstance ( ) . removeResultCallback ( mSetCustomLocationCallback ) ; } mCustomLocationHolderView . setVisibility ( ( visibility ? View . VISIBLE : View . GONE ) ) ; } } <START_BUG> if ( ( ( mSearchView ) != null ) && ( ! visibility ) ) { <END_BUG> mSearchView . setVisibility ( ( visibility ? View . VISIBLE : View . INVISIBLE ) ) ; } } }

Fix:
if ( ( mSearchView ) != null ) {