Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit f0359b5c authored by thebaron06's avatar thebaron06 Committed by GitHub
Browse files

check quota object presence before accessing it

When the quot information is missing in the server response, accessing it will cause an null pointer exception.
So we check for the presence of a quota object within the server response and, if not present, we set a new quota
that reflects the fact that the quota limit is not available for this user.
parent 70f0f445
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -127,6 +127,12 @@ public class GetRemoteUserInfoOperation extends OCSRemoteOperation {
                        userInfo.setId(userID);
                }

                if (userInfo.getQuota() == null) {
                    Log_OC.e(TAG, "No quota in server response, use default quota");
                    userInfo.setQuota(new Quota());
                    userInfo.getQuota().setQuota(QUOTA_LIMIT_INFO_NOT_AVAILABLE);
                }
                
                if (userInfo.getQuota().getQuota() == 0) {
                    userInfo.getQuota().setQuota(QUOTA_LIMIT_INFO_NOT_AVAILABLE);
                }