Make nsFind::Find handle empty string searches.
parent
e53bfec76a
commit
e0c3ac5fb4
|
@ -967,6 +967,11 @@ nsFind::Find(const char16_t* aPatText, nsIDOMRange* aSearchRange,
|
|||
const char16_t* patStr = patAutoStr.get();
|
||||
int32_t patLen = patAutoStr.Length() - 1;
|
||||
|
||||
// If this function is called with an empty string, we should early exit.
|
||||
if (patLen < 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// current offset into the pattern -- reset to beginning/end:
|
||||
int32_t pindex = (mFindBackward ? patLen : 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue