Describe the bug
Extension that overrides == operator for Optional<[String:Any]> causes infinite loop with stack overflow when comparing two nil optionals of this type.
To reproduce
- Add LaunchDarkly 4.0 to Podfile:
pod 'LaunchDarkly', '~>4.0.0'
- Run
pod install
- Add following code anywhere in application
let dict1: [String: Any]? = nil
let dict2: [String: Any]? = nil
if dict1 == dict2 {
print("This will never be printed")
}
- Run the application and make sure the code executes.
- Application will crash due to stack overflow because of line 79 in
LaunchDarkly/Extensions/Dictionary.swift - it enters recursive loop in case of lhs and rhs both being nil.
Expected behavior
== should return true for comparison of two nil [String:Any]?objects.
SDK version
4.0.0
Language version, developer tools
Swift 5
OS/platform
iOS 12