mirror of
				https://github.com/KokaKiwi/BarInsta
				synced 2025-11-04 05:25:35 +00:00 
			
		
		
		
	Handle null context! Need to add this check in all async listeners.
This commit is contained in:
		
							parent
							
								
									61851f2ef7
								
							
						
					
					
						commit
						d4a28d6aa1
					
				@ -1,5 +1,6 @@
 | 
				
			|||||||
package awais.instagrabber.fragments;
 | 
					package awais.instagrabber.fragments;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.content.Context;
 | 
				
			||||||
import android.content.res.ColorStateList;
 | 
					import android.content.res.ColorStateList;
 | 
				
			||||||
import android.graphics.Typeface;
 | 
					import android.graphics.Typeface;
 | 
				
			||||||
import android.os.AsyncTask;
 | 
					import android.os.AsyncTask;
 | 
				
			||||||
@ -223,7 +224,7 @@ public class HashTagFragment extends Fragment {
 | 
				
			|||||||
        postsViewModel.getList().observe(fragmentActivity, postsAdapter::submitList);
 | 
					        postsViewModel.getList().observe(fragmentActivity, postsAdapter::submitList);
 | 
				
			||||||
        binding.mainPosts.setAdapter(postsAdapter);
 | 
					        binding.mainPosts.setAdapter(postsAdapter);
 | 
				
			||||||
        final RecyclerLazyLoader lazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
 | 
					        final RecyclerLazyLoader lazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
 | 
				
			||||||
            if (!hasNextPage) return;
 | 
					            if (!hasNextPage || getContext() == null) return;
 | 
				
			||||||
            binding.swipeRefreshLayout.setRefreshing(true);
 | 
					            binding.swipeRefreshLayout.setRefreshing(true);
 | 
				
			||||||
            fetchPosts();
 | 
					            fetchPosts();
 | 
				
			||||||
            endCursor = null;
 | 
					            endCursor = null;
 | 
				
			||||||
@ -235,6 +236,7 @@ public class HashTagFragment extends Fragment {
 | 
				
			|||||||
        stopCurrentExecutor();
 | 
					        stopCurrentExecutor();
 | 
				
			||||||
        binding.swipeRefreshLayout.setRefreshing(true);
 | 
					        binding.swipeRefreshLayout.setRefreshing(true);
 | 
				
			||||||
        currentlyExecuting = new HashtagFetcher(hashtag.substring(1), result -> {
 | 
					        currentlyExecuting = new HashtagFetcher(hashtag.substring(1), result -> {
 | 
				
			||||||
 | 
					            if (getContext() == null) return;
 | 
				
			||||||
            hashtagModel = result;
 | 
					            hashtagModel = result;
 | 
				
			||||||
            binding.swipeRefreshLayout.setRefreshing(false);
 | 
					            binding.swipeRefreshLayout.setRefreshing(false);
 | 
				
			||||||
            if (hashtagModel == null) {
 | 
					            if (hashtagModel == null) {
 | 
				
			||||||
 | 
				
			|||||||
@ -327,6 +327,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private void fetchProfileDetails() {
 | 
					    private void fetchProfileDetails() {
 | 
				
			||||||
        new ProfileFetcher(username.substring(1), profileModel -> {
 | 
					        new ProfileFetcher(username.substring(1), profileModel -> {
 | 
				
			||||||
 | 
					            if (getContext() == null) return;
 | 
				
			||||||
            this.profileModel = profileModel;
 | 
					            this.profileModel = profileModel;
 | 
				
			||||||
            final String userIdFromCookie = Utils.getUserIdFromCookie(cookie);
 | 
					            final String userIdFromCookie = Utils.getUserIdFromCookie(cookie);
 | 
				
			||||||
            final boolean isSelf = isLoggedIn
 | 
					            final boolean isSelf = isLoggedIn
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user