Skip to content

Commit 088cf0b

Browse files
committed
Fix when object not AnyHashable
1 parent a8018e7 commit 088cf0b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Foundation/NSKeyedArchiver.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,11 @@ open class NSKeyedArchiver : NSCoder {
553553
}
554554

555555
// check replacement cache
556-
objectToEncode = self._replacementMap[object as! AnyHashable]
557-
if objectToEncode != nil {
558-
return objectToEncode
556+
if let hashable = object as? AnyHashable {
557+
objectToEncode = self._replacementMap[hashable]
558+
if objectToEncode != nil {
559+
return objectToEncode
560+
}
559561
}
560562

561563
// object replaced by NSObject.replacementObject(for:)

0 commit comments

Comments
 (0)