Buggy code:
public class ControllerSearch { public static final int PAGE_SUBREDDITS = 0 ; public static final int PAGE_LINKS_SUBREDDIT = 1 ; public static final int PAGE_LINKS = 2 ; public static final int PAGE_SUBREDDITS_RECOMMENDED = 3 ; private static final String TAG = ControllerSearch . class . getCanonicalName ( ) ; private ControllerLinks controllerLinks ; private ControllerUser controllerUser ; private Set < ControllerSearch . Listener > listeners = new HashSet < > ( ) ; private SharedPreferences preferences ; private Listing subredditsLoaded = new Listing ( ) ; private Listing subredditsSubscribed = new Listing ( ) ; private Listing subreddits = new Listing ( ) ; private Listing subredditsRecommended = new Listing ( ) ; private Listing links = new Listing ( ) ; private Listing linksSubreddit = new Listing ( ) ; private String query = "" ; private Sort sort = Sort . RELEVANCE ; private Sort sortSubreddits = Sort . RELEVANCE ; private Time time = Time . ALL ; private volatile int currentPage ; private Subscription subscriptionSubreddits ; private Subscription subscriptionLinks ; private Subscription subscriptionLinksSubreddit ; private boolean isLoadingLinks ; private boolean isLoadingLinksSubreddit ; private List < Subscription > subscriptionsSubredditsRecommended = new ArrayList < > ( ) ; private String currentSubreddit ; @ Inject AccountManager accountManager ; @ Inject Reddit reddit ; public ControllerSearch ( Context context , ControllerLinks controllerLinks , ControllerUser controllerUser ) { } public void addListener ( ControllerSearch . Listener listener ) { } public void removeListener ( ControllerSearch . Listener listener ) { } public Observable < Listing > setData ( int page , String query , Sort sort , Time time ) { } public Observable < Listing > setQuery ( String query ) { } public void setTitle ( ) { } public void reloadSubscriptionList ( ) { } private void loadMoreSubscriptions ( ) { } private void saveSubscriptions ( Listing listing ) { } public void saveSubscriptions ( ) { } private void loadContributorSubreddits ( ) { } private void loadMoreContributorSubreddits ( ) { } public Observable < Listing > reloadCurrentPage ( ) { } public void reloadSubreddits ( ) { } public void reloadSubredditsRecommended ( ) { } public Observable < Listing > reloadLinks ( ) { } public Observable < Listing > reloadLinksSubreddit ( ) { } public Subreddit getSubreddit ( int position ) { } public int getCountSubreddit ( ) { } public Subreddit getSubredditRecommended ( int position ) { } public int getCountSubredditRecommended ( ) { } public Link getLink ( int position ) { } public int sizeLinks ( ) { } public boolean isLoadingLinks ( ) { } public Observable < Listing > loadMoreLinks ( ) { } private void setLoadingLinks ( boolean loading ) { } public Link getLinkSubreddit ( int position ) { } public int sizeLinksSubreddit ( ) { } public boolean isLoadingLinksSubreddit ( ) { } public Observable < Listing > loadMoreLinksSubreddit ( ) { if ( isLoadingLinksSubreddit ( ) ) { return Observable . empty ( ) ; } Subreddit subreddit = controllerLinks . getSubreddit ( ) ; <START_BUG> if ( ( ( subscriptionLinksSubreddit ) != null ) && ( ! ( subscriptionSubreddits . isUnsubscribed ( ) ) ) ) { <END_BUG> subscriptionLinksSubreddit . unsubscribe ( ) ; subscriptionLinksSubreddit = null ; } String pathSubreddit = subreddit . getUrl ( ) ; if ( ( pathSubreddit . length ( ) ) < 2 ) { pathSubreddit = "" ; } Observable < Listing > observable = reddit . search ( pathSubreddit , query , sort . toString ( ) , time . toString ( ) , linksSubreddit . getAfter ( ) , true ) . flatMap ( FLAT_MAP ) ; subscriptionLinksSubreddit = observable . subscribe ( new com . winsonchiu . reader . utils . FinalizingSubscriber < Listing > ( ) { @ Override public void start ( ) { setLoadingLinksSubreddit ( true ) ; } @ Override public void next ( Listing listing ) { if ( ( listing . getChildren ( ) . isEmpty ( ) ) || ( ( listing . getChildren ( ) . get ( 0 ) ) instanceof Subreddit ) ) { return ; } int startSize = linksSubreddit . getChildren ( ) . size ( ) ; int positionStart = startSize + 1 ; linksSubreddit . addChildren ( listing . getChildren ( ) ) ; linksSubreddit . setAfter ( listing . getAfter ( ) ) ; for ( ControllerSearch . Listener listener : listeners ) { listener . getAdapterLinksSubreddit ( ) . notifyItemRangeInserted ( positionStart , ( ( linksSubreddit . getChildren ( ) . size ( ) ) - startSize ) ) ; } } @ Override public void finish ( ) { setLoadingLinksSubreddit ( false ) ; } } ) ; return observable ; } private void setLoadingLinksSubreddit ( boolean loading ) { } public Observable < Listing > setSort ( Sort sort ) { } public Observable < Listing > setTime ( Time time ) { } public String getQuery ( ) { } public Observable < Listing > setCurrentPage ( int currentPage ) { } public int getCurrentPage ( ) { } public void addSubreddit ( Subreddit subreddit ) { } public boolean setReplyTextLinks ( String name , String text , boolean collapsed ) { } public boolean setReplyTextLinksSubreddit ( String name , String text , boolean collapsed ) { } public void setNsfwLinks ( String name , boolean over18 ) { } public void setNsfwLinksSubreddit ( String name , boolean over18 ) { } public void moveSubreddit ( int startAdapterPosition , int targetAdapterPosition ) { } public boolean isSubscriptionListShown ( ) { } public void addViewedSubreddit ( Subreddit subreddit ) { } public interface Listener extends ControllerListener { AdapterSearchSubreddits getAdapterSearchSubreddits ( ) { } AdapterSearchSubreddits getAdapterSearchSubredditsRecommended ( ) { } AdapterLink getAdapterLinks ( ) { } AdapterLink getAdapterLinksSubreddit ( ) { } void setToolbarTitle ( CharSequence title ) { } void setSortAndTime ( Sort sort , Time time ) { }

Fix:
if ( ( ( subscriptionLinksSubreddit ) != null ) && ( ! ( subscriptionLinksSubreddit . isUnsubscribed ( ) ) ) ) {