Эх сурвалжийг харах

Fixing NULL pointer in execution without accounts created

David A. Velasco 12 жил өмнө
parent
commit
7fead3cb22

+ 2 - 2
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -941,13 +941,13 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         public void onServiceConnected(ComponentName className, IBinder service) {
             mDownloaderBinder = (FileDownloaderBinder) service;
             // a new chance to get the mDownloadBinder through getDownloadBinder() - THIS IS A MESS
-            mFileList.listDirectory();
+            if (mFileList != null)
+                mFileList.listDirectory();
             if (mDualPane) {
                 FileDetailFragment fragment = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);
                 if (fragment != null)
                     fragment.updateFileDetails();
             }
-            
         }
 
         @Override

+ 19 - 17
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -172,28 +172,30 @@ public class OCFileListFragment extends FragmentListView {
      */
     public void listDirectory(OCFile directory) {
         DataStorageManager storageManager = mContainerActivity.getStorageManager();
+        if (storageManager != null) {
 
-        // Check input parameters for null
-        if(directory == null){
-            if(mFile != null){
-                directory = mFile;
-            } else {
-                directory = storageManager.getFileByPath("/");
-                if (directory == null) return; // no files, wait for sync
+            // Check input parameters for null
+            if(directory == null){
+                if(mFile != null){
+                    directory = mFile;
+                } else {
+                    directory = storageManager.getFileByPath("/");
+                    if (directory == null) return; // no files, wait for sync
+                }
             }
-        }
         
         
-        // If that's not a directory -> List its parent
-        if(!directory.isDirectory()){
-            Log.w(TAG, "You see, that is not a directory -> " + directory.toString());
-            directory = storageManager.getFileById(directory.getParentId());
-        }
+            // If that's not a directory -> List its parent
+            if(!directory.isDirectory()){
+                Log.w(TAG, "You see, that is not a directory -> " + directory.toString());
+                directory = storageManager.getFileById(directory.getParentId());
+            }
 
-        mFile = directory;
-        mAdapter.swapDirectory(mFile);
-        mList.setSelectionFromTop(0, 0);
-        mList.invalidate();
+            mFile = directory;
+            mAdapter.swapDirectory(mFile);
+            mList.setSelectionFromTop(0, 0);
+            mList.invalidate();
+        }
     }