Browse Source

dont crash when no synchronization were done and user tries to create dir

Bartek Przybylski 12 years ago
parent
commit
d8e0387aef
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java

+ 12 - 1
src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java

@@ -414,7 +414,18 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
                             }
     
                             // Figure out the path where the dir needs to be created
-                            String path = FileDisplayActivity.this.mCurrentDir.getRemotePath();
+                            String path;
+                            if (mCurrentDir == null) {
+                                if (!mStorageManager.fileExists("/")) {
+                                    OCFile file = new OCFile("/");
+                                    mStorageManager.saveFile(file);
+                                    mCurrentDir = mStorageManager.getFileByPath("/");
+                                } else {
+                                    Log.wtf("FileDisplay", "OMG NO!");
+                                    return;
+                                }
+                            }
+                            path = FileDisplayActivity.this.mCurrentDir.getRemotePath();
                             
                             // Create directory
                             path += directoryName + "/";