Răsfoiți Sursa

Merge pull request #713 from nextcloud/fix-quota-crash

Fix quota crash
Mario Đanić 8 ani în urmă
părinte
comite
e883ac19f3

+ 2 - 2
AndroidManifest.xml

@@ -20,8 +20,8 @@
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.owncloud.android"
-    android:versionCode="10040201"
-    android:versionName="1.4.2 RC1">
+    android:versionCode="10040202"
+    android:versionName="1.4.2 RC2">
 
     <uses-sdk
         android:minSdkVersion="14"

+ 1 - 1
build.gradle

@@ -45,7 +45,7 @@ dependencies {
     compile name: 'touch-image-view'
     compile 'com.android.support:multidex:1.0.1'
 
-    compile 'com.github.nextcloud:android-library:1.0.12'
+    compile 'com.github.nextcloud:android-library:1.0.13'
     compile "com.android.support:support-v4:${supportLibraryVersion}"
     compile "com.android.support:design:${supportLibraryVersion}"
     compile 'com.jakewharton:disklrucache:2.0.2'

+ 29 - 27
src/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -632,34 +632,36 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
                     final UserInfo userInfo = (UserInfo) result.getData().get(0);
                     final Quota quota = userInfo.getQuota();
 
-                    final long used = quota.getUsed();
-                    final long total = quota.getTotal();
-                    final int relative = (int) Math.ceil(quota.getRelative());
-                    final long quotaValue = quota.getQuota();
-
-                    runOnUiThread(new Runnable() {
-                        @Override
-                        public void run() {
-                            if (quotaValue > 0
-                                    || quotaValue == GetRemoteUserInfoOperation.QUOTA_LIMIT_INFO_NOT_AVAILABLE) {
-                                /**
-                                 * show quota in case
-                                 * it is available and calculated (> 0) or
-                                 * in case of legacy servers (==QUOTA_LIMIT_INFO_NOT_AVAILABLE)
-                                 */
-                                setQuotaInformation(used, total, relative);
-                            } else {
-                                /**
-                                 * quotaValue < 0 means special cases like
-                                 * {@link RemoteGetUserQuotaOperation.SPACE_NOT_COMPUTED},
-                                 * {@link RemoteGetUserQuotaOperation.SPACE_UNKNOWN} or
-                                 * {@link RemoteGetUserQuotaOperation.SPACE_UNLIMITED}
-                                 * thus don't display any quota information.
-                                 */
-                                showQuota(false);
+                    if (quota != null) {
+                        final long used = quota.getUsed();
+                        final long total = quota.getTotal();
+                        final int relative = (int) Math.ceil(quota.getRelative());
+                        final long quotaValue = quota.getQuota();
+
+                        runOnUiThread(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (quotaValue > 0
+                                        || quotaValue == GetRemoteUserInfoOperation.QUOTA_LIMIT_INFO_NOT_AVAILABLE) {
+                                    /**
+                                     * show quota in case
+                                     * it is available and calculated (> 0) or
+                                     * in case of legacy servers (==QUOTA_LIMIT_INFO_NOT_AVAILABLE)
+                                     */
+                                    setQuotaInformation(used, total, relative);
+                                } else {
+                                    /**
+                                     * quotaValue < 0 means special cases like
+                                     * {@link RemoteGetUserQuotaOperation.SPACE_NOT_COMPUTED},
+                                     * {@link RemoteGetUserQuotaOperation.SPACE_UNKNOWN} or
+                                     * {@link RemoteGetUserQuotaOperation.SPACE_UNLIMITED}
+                                     * thus don't display any quota information.
+                                     */
+                                    showQuota(false);
+                                }
                             }
-                        }
-                    });
+                        });
+                    }
                 }
             }
         });