mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-11-04 08:43:52 +01:00 
			
		
		
		
	Fixed NPE when uploading
This commit is contained in:
		
							parent
							
								
									bc1adca999
								
							
						
					
					
						commit
						d34ddf3379
					
				
					 2 changed files with 6 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -65,7 +65,7 @@ public class FileProcessor {
 | 
			
		|||
     */
 | 
			
		||||
    @Nullable
 | 
			
		||||
    String getPathOfMediaOrCopy() {
 | 
			
		||||
        filePath = FileUtils.getPath(getApplicationContext(), mediaUri);
 | 
			
		||||
        filePath = FileUtils.getPath(context, mediaUri);
 | 
			
		||||
        Timber.d("Filepath: " + filePath);
 | 
			
		||||
        if (filePath == null) {
 | 
			
		||||
            String copyPath = null;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -268,6 +268,7 @@ public class ShareActivity
 | 
			
		|||
        finish();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onCreate(Bundle savedInstanceState) {
 | 
			
		||||
        super.onCreate(savedInstanceState);
 | 
			
		||||
| 
						 | 
				
			
			@ -312,13 +313,6 @@ public class ShareActivity
 | 
			
		|||
 | 
			
		||||
        ContentResolver contentResolver = this.getContentResolver();
 | 
			
		||||
 | 
			
		||||
        fileObj = new FileProcessor(mediaUri, contentResolver, prefs, this);
 | 
			
		||||
        String filePath = fileObj.getPathOfMediaOrCopy();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        checkIfFileExists();
 | 
			
		||||
        fileObj.getFileCoordinates(locationPermitted);
 | 
			
		||||
 | 
			
		||||
        SingleUploadFragment shareView = (SingleUploadFragment) getSupportFragmentManager().findFragmentByTag("shareView");
 | 
			
		||||
        categorizationFragment = (CategorizationFragment) getSupportFragmentManager().findFragmentByTag("categorization");
 | 
			
		||||
        if (shareView == null && categorizationFragment == null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -329,6 +323,10 @@ public class ShareActivity
 | 
			
		|||
                    .commitAllowingStateLoss();
 | 
			
		||||
        }
 | 
			
		||||
        uploadController.prepareService();
 | 
			
		||||
 | 
			
		||||
        fileObj = new FileProcessor(mediaUri, contentResolver, prefs, this);
 | 
			
		||||
        checkIfFileExists();
 | 
			
		||||
        fileObj.getFileCoordinates(locationPermitted);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue