dont crash when no synchronization were done and user tries to create dir
authorBartek Przybylski <bart.p.pl@gmail.com>
Sun, 24 Jun 2012 13:47:20 +0000 (15:47 +0200)
committerBartek Przybylski <bart.p.pl@gmail.com>
Sun, 24 Jun 2012 13:47:20 +0000 (15:47 +0200)
src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java

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