[1.1.4] Region: findWord/findLine crash if nothing is found --- fixed 2018-11-24 build 131

Bug #1804875 reported by Michael Bvhm on 2018-11-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sikuli
Critical
RaiMan

Bug Description

following code will raise an exception in case the word is not found, all is fine in case the word is here:

areaLeft.setThrowException(False)
for i in range(1,25):
        match=areaLeft.findWord(str(i))
        if match!=None:
            match.highlight(1)

thats the error:
[error] script [ TWD ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\temp\SikuliX\TWD.sikuli\TWD.py", line 2102, in <module> runStats() File "C:\temp\SikuliX\TWD.sikuli\TWD.py", line 1043, in runStats match=areaLeft.findWord(str(i)) at org.sikuli.script.Region.findWord(Region.java:2736)
at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
java.lang.ClassCastException: java.lang.ClassCastException: org.sikuli.script.Finder cannot be cast to org.sikuli.script.Match

system is Windows 10, SikulixIDE 1.1.4

others:
*) findText does not throw exception, but does only find 10% of the text
*) try: except: results into the same issue

RaiMan (raimund-hocke) wrote :

thanks for the good problem description

summary: - .findWord raises exception in case nothing is found
+ [1.1.4] Region: findWord/findLine crash if nothing is found --- fixed
+ 2018-11-24 build 131
Changed in sikuli:
status: New → Fix Committed
importance: Undecided → Critical
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.4
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers