Преглед изворни кода

修复order detail 中customer contact为空和不存在空格的情况引起crash

Pen Li пре 9 година
родитељ
комит
54dd64899c

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 10 - 3
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -5829,9 +5829,16 @@
     contactInfo[@"customer_phone"] = customer_phone;
     contactInfo[@"customer_fax"] = customer_fax;
     contactInfo[@"customer_email"] = customer_email;
-    NSInteger first_space_index = [customer_contact rangeOfString:@" "].location;
-    NSString *first_name = [customer_contact substringToIndex:first_space_index];
-    NSString *last_name = [customer_contact substringFromIndex:first_space_index + 1];
+    NSString *first_name = @"";
+     NSString *last_name = @"";
+    if ([customer_contact isEqualToString:@""]) {
+        
+    } else if ([customer_contact containsString:@" "]) {
+        NSInteger first_space_index = [customer_contact rangeOfString:@" "].location;
+        first_name = [customer_contact substringToIndex:first_space_index];
+        last_name = [customer_contact substringFromIndex:first_space_index + 1];
+    }
+    
     contactInfo[@"customer_first_name"] = first_name;
     contactInfo[@"customer_last_name"] = last_name;