MessageInputBar icon indicating copy to clipboard operation
MessageInputBar copied to clipboard

Crash when attaching multiple images to MessageInputBar

Open tkeithblack opened this issue 7 years ago • 5 comments

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 avatar Jan 07 '19 01:01 tkeithblack

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

Here'a a screenshot in the debugger showing the fix

messagekitscreenshot .

tkeithblack avatar Jan 07 '19 01:01 tkeithblack

Thanks @tkeithblack , want to make a PR?

Sent with GitHawk

nathantannar4 avatar Jan 07 '19 03:01 nathantannar4

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

Keith

On Sun, Jan 6, 2019 at 9:36 PM Nathan Tannar [email protected] 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 .

tkeithblack avatar Jan 07 '19 21:01 tkeithblack

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

Sent with GitHawk

nathantannar4 avatar Jan 08 '19 00:01 nathantannar4

#17

tkeithblack avatar Jan 09 '19 00:01 tkeithblack