mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-26 05:05:52 +10:00
guard characters.count > index in yep_mentionWordInIndex
This commit is contained in:
@@ -47,11 +47,13 @@ extension String {
|
||||
|
||||
func yep_mentionWordInIndex(index: Int) -> (wordString: String, mentionWordRange: Range<Index>)? {
|
||||
|
||||
println("startIndex: \(startIndex), endIndex: \(endIndex), index: \(index), length: \((self as NSString).length), count: \(self.characters.count)")
|
||||
|
||||
guard index > 0 else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard (self as NSString).length > index else {
|
||||
guard self.characters.count > index else {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user