Skip to content

Commit d2f0a4b

Browse files
committed
fix: null object error
Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
1 parent e4fb3e8 commit d2f0a4b

2 files changed

Lines changed: 29 additions & 15 deletions

File tree

.kotlin/sessions/kotlin-compiler-3623059900860280110.salive

Whitespace-only changes.

app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -976,12 +976,16 @@ protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) {
976976
*/
977977
private void showQuota(boolean showQuota) {
978978
if (showQuota) {
979-
mQuotaView.setVisibility(View.VISIBLE);
979+
if (mQuotaView != null) {
980+
mQuotaView.setVisibility(View.VISIBLE);
981+
}
980982
if (mSidebarQuotaView != null) {
981983
mSidebarQuotaView.setVisibility(View.VISIBLE);
982984
}
983985
} else {
984-
mQuotaView.setVisibility(View.GONE);
986+
if (mQuotaView != null) {
987+
mQuotaView.setVisibility(View.GONE);
988+
}
985989
if (mSidebarQuotaView != null) {
986990
mSidebarQuotaView.setVisibility(View.GONE);
987991
}
@@ -998,20 +1002,24 @@ private void showQuota(boolean showQuota) {
9981002
*/
9991003
private void setQuotaInformation(long usedSpace, long totalSpace, int relative, long quotaValue) {
10001004
if (GetUserInfoRemoteOperation.SPACE_UNLIMITED == quotaValue) {
1001-
mQuotaTextPercentage.setText(String.format(
1002-
getString(R.string.drawer_quota_unlimited),
1003-
DisplayUtils.bytesToHumanReadable(usedSpace)));
1005+
if (mQuotaTextPercentage != null) {
1006+
mQuotaTextPercentage.setText(String.format(
1007+
getString(R.string.drawer_quota_unlimited),
1008+
DisplayUtils.bytesToHumanReadable(usedSpace)));
1009+
}
10041010

10051011
if (mSidebarQuotaTextPercentage != null) {
10061012
mSidebarQuotaTextPercentage.setText(String.format(
10071013
getString(R.string.drawer_quota_unlimited),
10081014
DisplayUtils.bytesToHumanReadable(usedSpace)));
10091015
}
10101016
} else {
1011-
mQuotaTextPercentage.setText(String.format(
1012-
getString(R.string.drawer_quota),
1013-
DisplayUtils.bytesToHumanReadable(usedSpace),
1014-
DisplayUtils.bytesToHumanReadable(totalSpace)));
1017+
if (mQuotaTextPercentage != null) {
1018+
mQuotaTextPercentage.setText(String.format(
1019+
getString(R.string.drawer_quota),
1020+
DisplayUtils.bytesToHumanReadable(usedSpace),
1021+
DisplayUtils.bytesToHumanReadable(totalSpace)));
1022+
}
10151023

10161024
if (mSidebarQuotaTextPercentage != null) {
10171025
mSidebarQuotaTextPercentage.setText(String.format(
@@ -1021,22 +1029,28 @@ private void setQuotaInformation(long usedSpace, long totalSpace, int relative,
10211029
}
10221030
}
10231031

1024-
mQuotaProgressBar.setProgress(relative);
1032+
if (mQuotaProgressBar != null) {
1033+
mQuotaProgressBar.setProgress(relative);
1034+
}
10251035

10261036
if (mSidebarQuotaProgressBar != null) {
10271037
mSidebarQuotaProgressBar.setProgress(relative);
10281038
}
10291039

10301040
if (relative < RELATIVE_THRESHOLD_WARNING) {
1031-
viewThemeUtils.material.colorProgressBar(mQuotaProgressBar, ColorRole.PRIMARY);
1041+
if (mQuotaProgressBar != null) {
1042+
viewThemeUtils.material.colorProgressBar(mQuotaProgressBar, ColorRole.PRIMARY);
1043+
}
10321044
if (mSidebarQuotaProgressBar != null) {
10331045
viewThemeUtils.material.colorProgressBar(mSidebarQuotaProgressBar, ColorRole.PRIMARY);
10341046
}
10351047
} else {
1036-
viewThemeUtils.material.colorProgressBar(
1037-
mQuotaProgressBar,
1038-
getResources().getColor(R.color.infolevel_warning, null)
1039-
);
1048+
if (mQuotaProgressBar != null) {
1049+
viewThemeUtils.material.colorProgressBar(
1050+
mQuotaProgressBar,
1051+
getResources().getColor(R.color.infolevel_warning, null)
1052+
);
1053+
}
10401054

10411055
if (mSidebarQuotaProgressBar != null) {
10421056
viewThemeUtils.material.colorProgressBar(

0 commit comments

Comments
 (0)