Explorar o código

keep Wrapper's more elegant getConfigInt syntax

cyberta %!s(int64=5) %!d(string=hai) anos
pai
achega
523bd0c3c8
Modificáronse 1 ficheiros con 3 adicións e 8 borrados
  1. 3 8
      DcCore/DcCore/DC/Wrapper.swift

+ 3 - 8
DcCore/DcCore/DC/Wrapper.swift

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