Skip to content

makeInteractive Crash fix when NSRange.location == NSNotFound#28

Merged
evermeer merged 1 commit intoevermeer:masterfrom
HaysSoftware:feature/SkipRangeNotFound
Dec 23, 2018
Merged

makeInteractive Crash fix when NSRange.location == NSNotFound#28
evermeer merged 1 commit intoevermeer:masterfrom
HaysSoftware:feature/SkipRangeNotFound

Conversation

@jameshays
Copy link
Copy Markdown
Contributor

If the range location can't be found, return without attempting to add a link. This would crash previously.

@evermeer
Copy link
Copy Markdown
Owner

Thanks!

I do have one question. Why are you using:
guard nsRange.location != NSNotFound else { return self }
Instead of just:
if nsRange.location == NSNotFound { return self }

@jameshays
Copy link
Copy Markdown
Contributor Author

Mainly just personal preference. To me, it reads better. If I use an “if” statement, I typically expect the body to do something. The guard is then just used more as an assert. Both accomplish the same thing in this case.

@evermeer evermeer merged commit 74a3090 into evermeer:master Dec 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants