wordpress-mobile / wordpress-mobile/AztecEditor-iOS
aDecoder.decodeInteger on nullable int causes crash
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 669
- Forks
- 153
- Avg merge
- 11h 27m
- Merged PRs (30d)
- 4
Description
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: https://github.com/wordpress-mobile/AztecEditor-iOS/blob/e0cb3c96ada0bed9fab5d3e93952e8375b29d97e/Aztec/Classes/TextKit/ParagraphProperty/TextList.swift#L83
Now, when pasting, a crash occurs here because it expects a non-nil-int: https://github.com/wordpress-mobile/AztecEditor-iOS/blob/e0cb3c96ada0bed9fab5d3e93952e8375b29d97e/Aztec/Classes/TextKit/ParagraphProperty/TextList.swift#L64
This can be fixed by changing that line to:
let decodedStart = aDecoder.decodeObject(forKey: AttributeType.start.rawValue) as? Int
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Aztec/Classes/TextKit/ParagraphProperty/TextList.swift, at the decoding line around 64 and the nullable value encoded around line 83. Reproduce copy-pasting a list with HTML pasting disabled, then verify that decoding the nullable integer no longer crashes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100