Sfoglia il codice sorgente

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

Pen Li 8 anni fa
parent
commit
207fbed03a
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  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;