Explorar o código

1.修改iOS Apex Mobile KPI全部为0时崩溃。

Pen Li %!s(int64=8) %!d(string=hai) anos
pai
achega
207fbed03a
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      Apex Mobile/Apex Mobile/KPICell.m

+ 4 - 1
Apex Mobile/Apex Mobile/KPICell.m

@@ -59,7 +59,10 @@
         NSMutableDictionary* item =[arr_data[i] mutableCopy];
         if([item[@"display"] boolValue]==true)
         {
-            float percent =[item[@"A_val"] floatValue] / total *100;
+            float percent = 0.f;
+            if (total > 0) {
+                percent = [item[@"A_val"] floatValue] / total *100;
+            }
             item[@"CP_val"] = [NSNumber numberWithFloat:percent];
             arr_data[i] = item;