Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enkoting of array leads to incorrect result #12

Closed
letko-dmitry opened this issue Mar 26, 2017 · 2 comments
Closed

Enkoting of array leads to incorrect result #12

letko-dmitry opened this issue Mar 26, 2017 · 2 comments
Labels

Comments

@letko-dmitry
Copy link
Contributor

letko-dmitry commented Mar 26, 2017

Hi,

It seems there is misprint in the realization of the public func enkotObject(_ object: [Koting]?, forKey key: AnyHashable). flatMap is used there and it leads to unwrapping of Data as an array of UInt8. As a result we get a massive collection of UInt8.
While dekoting we cast the collection to array of Data type and the cast always fails. Please, check the public func dekotObject<T: Koting>(forKey key: AnyHashable) -> [T]?.
I think simple use map instead of flatMap will make the mechanism behave as expected.

@artemstepanenko
Copy link
Owner

Hello, @letko-dmitry .
Thank you so much for creating such a well-explained issue and making a PR.
Your PR is merged. No doubts the unwrapping was useless.
Also, I want to investigate the problem a bit more, I never thought of anything like this.

@letko-dmitry
Copy link
Contributor Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants