Skip to content

Commit e883ac1

Browse files
authored
Merge pull request #713 from nextcloud/fix-quota-crash
Fix quota crash
2 parents f0bbb4b + 657dbcd commit e883ac1

File tree

3 files changed

+32
-30
lines changed

3 files changed

+32
-30
lines changed

Diff for: AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
-->
2121
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2222
package="com.owncloud.android"
23-
android:versionCode="10040201"
24-
android:versionName="1.4.2 RC1">
23+
android:versionCode="10040202"
24+
android:versionName="1.4.2 RC2">
2525

2626
<uses-sdk
2727
android:minSdkVersion="14"

Diff for: build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies {
4545
compile name: 'touch-image-view'
4646
compile 'com.android.support:multidex:1.0.1'
4747

48-
compile 'com.github.nextcloud:android-library:1.0.12'
48+
compile 'com.github.nextcloud:android-library:1.0.13'
4949
compile "com.android.support:support-v4:${supportLibraryVersion}"
5050
compile "com.android.support:design:${supportLibraryVersion}"
5151
compile 'com.jakewharton:disklrucache:2.0.2'

Diff for: src/com/owncloud/android/ui/activity/DrawerActivity.java

+29-27
Original file line numberDiff line numberDiff line change
@@ -632,34 +632,36 @@ public void run() {
632632
final UserInfo userInfo = (UserInfo) result.getData().get(0);
633633
final Quota quota = userInfo.getQuota();
634634

635-
final long used = quota.getUsed();
636-
final long total = quota.getTotal();
637-
final int relative = (int) Math.ceil(quota.getRelative());
638-
final long quotaValue = quota.getQuota();
639-
640-
runOnUiThread(new Runnable() {
641-
@Override
642-
public void run() {
643-
if (quotaValue > 0
644-
|| quotaValue == GetRemoteUserInfoOperation.QUOTA_LIMIT_INFO_NOT_AVAILABLE) {
645-
/**
646-
* show quota in case
647-
* it is available and calculated (> 0) or
648-
* in case of legacy servers (==QUOTA_LIMIT_INFO_NOT_AVAILABLE)
649-
*/
650-
setQuotaInformation(used, total, relative);
651-
} else {
652-
/**
653-
* quotaValue < 0 means special cases like
654-
* {@link RemoteGetUserQuotaOperation.SPACE_NOT_COMPUTED},
655-
* {@link RemoteGetUserQuotaOperation.SPACE_UNKNOWN} or
656-
* {@link RemoteGetUserQuotaOperation.SPACE_UNLIMITED}
657-
* thus don't display any quota information.
658-
*/
659-
showQuota(false);
635+
if (quota != null) {
636+
final long used = quota.getUsed();
637+
final long total = quota.getTotal();
638+
final int relative = (int) Math.ceil(quota.getRelative());
639+
final long quotaValue = quota.getQuota();
640+
641+
runOnUiThread(new Runnable() {
642+
@Override
643+
public void run() {
644+
if (quotaValue > 0
645+
|| quotaValue == GetRemoteUserInfoOperation.QUOTA_LIMIT_INFO_NOT_AVAILABLE) {
646+
/**
647+
* show quota in case
648+
* it is available and calculated (> 0) or
649+
* in case of legacy servers (==QUOTA_LIMIT_INFO_NOT_AVAILABLE)
650+
*/
651+
setQuotaInformation(used, total, relative);
652+
} else {
653+
/**
654+
* quotaValue < 0 means special cases like
655+
* {@link RemoteGetUserQuotaOperation.SPACE_NOT_COMPUTED},
656+
* {@link RemoteGetUserQuotaOperation.SPACE_UNKNOWN} or
657+
* {@link RemoteGetUserQuotaOperation.SPACE_UNLIMITED}
658+
* thus don't display any quota information.
659+
*/
660+
showQuota(false);
661+
}
660662
}
661-
}
662-
});
663+
});
664+
}
663665
}
664666
}
665667
});

0 commit comments

Comments
 (0)