Skip to content

Commit

Permalink
Fix small bug in IA2TextInfo.getTextRange when retrieving an empty ra…
Browse files Browse the repository at this point in the history
…nge (#9029)

* Fix small bug in IA2TextInfo.getTextRange when retrieving an empty range

* Return early when expanding to a mouse unit and there is no text
  • Loading branch information
LeonarddeR authored and michaelDCurran committed Dec 8, 2018
1 parent 45e03f4 commit 4f780c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def expand(self,unit):
super(IA2TextTextInfo,self).expand(unit)
if isMouseChunkUnit:
text=self._getTextRange(self._startOffset,self._endOffset)
if not text:
return
try:
self._startOffset=text.rindex(u'\ufffc',0,oldStart-self._startOffset)
except ValueError:
Expand Down Expand Up @@ -199,7 +201,7 @@ def _getLineCount(self):

def _getTextRange(self,start,end):
try:
return self.obj.IAccessibleTextObject.text(start,end)
return self.obj.IAccessibleTextObject.text(start,end) or u""
except COMError:
return u""

Expand Down

0 comments on commit 4f780c0

Please sign in to comment.