Small stability improvement for HwndWrapper#WindowText(). This avoids exceptions of the form
Traceback (most recent call last): File "pywinauto\controls\HwndWrapper.pyc", line 262, in WindowText File "pywinauto\handleprops.pyc", line 58, in text File "ctypes\__init__.pyc", line 310, in create_unicode_buffer ValueError: Array length must be >= 0, not -5880895
This commit is contained in:
parent
e6578b90f1
commit
6f0f0304ff
@ -52,7 +52,9 @@ def text(handle):
|
||||
length = length.value
|
||||
|
||||
textval = ''
|
||||
if length:
|
||||
# In some rare cases, the length returned by WM_GETTEXTLENGTH is <0.
|
||||
# Guard against this by checking it is >0 (==0 is not of interest):
|
||||
if length > 0:
|
||||
length += 1
|
||||
|
||||
buffer_ = ctypes.create_unicode_buffer(length)
|
||||
|
Loading…
Reference in New Issue
Block a user