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

aDecoder.decodeInteger on nullable int causes crash #1331

Open
tipa opened this issue Apr 7, 2021 · 1 comment
Open

aDecoder.decodeInteger on nullable int causes crash #1331

tipa opened this issue Apr 7, 2021 · 1 comment

Comments

@tipa
Copy link

tipa commented Apr 7, 2021

In my fork, I disabled html pasting, which causes a crash when the user tries to copy-paste lists.
This is because Aztec might encode a nil-int when performing the copy:

aCoder.encode(start, forKey: AttributeType.start.rawValue)

Now, when pasting, a crash occurs here because it expects a non-nil-int:

let decodedStart = aDecoder.decodeInteger(forKey: AttributeType.start.rawValue)

This can be fixed by changing that line to:

let decodedStart = aDecoder.decodeObject(forKey: AttributeType.start.rawValue) as? Int
@SergioEstevao
Copy link
Contributor

Hi there, first of all thanks for the great bug report, do you want to submit a PR for the fix? I will review it and approve it if all goes well. It will also be great to add unit test for this specific crash in order to prevent future regressions.

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

No branches or pull requests

2 participants