Explorar el Código

Merge pull request #621 from deltachat/simplify-config-int

simplify getConfigInt()
cyBerta hace 5 años
padre
commit
905c9c47f9
Se han modificado 1 ficheros con 3 adiciones y 7 borrados
  1. 3 7
      deltachat-ios/DC/Wrapper.swift

+ 3 - 7
deltachat-ios/DC/Wrapper.swift

@@ -299,15 +299,11 @@ class DcContext {
     }
 
     func getConfigInt(_ key: String) -> Int {
-        let vStr = getConfig(key)
-        if vStr == nil {
-            return 0
-        }
-        let vInt = Int(vStr!)
-        if vInt == nil {
+        if let str = getConfig(key) {
+            return Int(str) ?? 0
+        } else {
             return 0
         }
-        return vInt!
     }
 
     private func setConfigInt(_ key: String, _ value: Int) {