浏览代码

bugfix quotaDic null

Marino Faggiana 8 年之前
父节点
当前提交
e96b3038f2
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      Libraries external/OCCommunicationLib/OCCommunicationLib/OCCommunication.m

+ 7 - 5
Libraries external/OCCommunicationLib/OCCommunicationLib/OCCommunication.m

@@ -1756,11 +1756,13 @@
                     
                 NSDictionary *quotaDic = [datas valueForKey:@"quota"];
                 
-                userProfile.quotaFree = [[quotaDic valueForKey:@"free"] doubleValue];
-                userProfile.quota = [[quotaDic valueForKey:@"quota"] doubleValue];
-                userProfile.quotaRelative = [[quotaDic valueForKey:@"relative"] doubleValue];
-                userProfile.quotaTotal = [[quotaDic valueForKey:@"total"] doubleValue];
-                userProfile.quotaUsed = [[quotaDic valueForKey:@"used"] doubleValue];
+                if ([quotaDic count]> 0) {
+                    userProfile.quotaFree = [[quotaDic valueForKey:@"free"] doubleValue];
+                    userProfile.quota = [[quotaDic valueForKey:@"quota"] doubleValue];
+                    userProfile.quotaRelative = [[quotaDic valueForKey:@"relative"] doubleValue];
+                    userProfile.quotaTotal = [[quotaDic valueForKey:@"total"] doubleValue];
+                    userProfile.quotaUsed = [[quotaDic valueForKey:@"used"] doubleValue];
+                }
                 
             } else {