浏览代码

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

Bartek Przybylski 13 年之前
父节点
当前提交
d8e0387aef
共有 1 个文件被更改,包括 12 次插入1 次删除
  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 + "/";