MessageKit / MessageInputBar

A powerful InputAccessoryView ideal for messaging applications
MIT License
64 stars 44 forks source link

Crash when attaching multiple images to MessageInputBar #16

Open tkeithblack opened 5 years ago

tkeithblack commented 5 years ago

# I encountered a crash when crash when inserting text followed by multiple pictures into the MessageInputBar.

The crash occurs in parseForComponents() located in InputTextView.swift.

The following line was the culprit:

let textRange = NSMakeRange(curLocation, range.location) This worked fine on the first image, but subsequent images crashed because the length should be range.location-curLocation as below:

let textRange = NSMakeRange(curLocation, range.location-curLocation) With this change it is now working.

KeithB

tkeithblack commented 5 years ago

I attempted to do a Pull Request, but may not have permission.

Here'a a screenshot in the debugger showing the fix

messagekitscreenshot .

nathantannar4 commented 5 years ago

Thanks @tkeithblack , want to make a PR?

Sent with GitHawk

tkeithblack commented 5 years ago

I attempted to, but was unable to push the change to development.

Keith

On Sun, Jan 6, 2019 at 9:36 PM Nathan Tannar notifications@github.com wrote:

Thanks @tkeithblack https://github.com/tkeithblack , want to make a PR?

Sent with GitHawk http://githawk.com

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MessageKit/MessageInputBar/issues/16#issuecomment-451812641, or mute the thread https://github.com/notifications/unsubscribe-auth/APlpe8K8iO05yR6CL2nHNbKwThgCU4VOks5vAsDFgaJpZM4Zys79 .

nathantannar4 commented 5 years ago

@tkeithblack If you fork MK to your own repo you can make a PR from tahr branch.

Sent with GitHawk

tkeithblack commented 5 years ago

17