Closed ubershy closed 7 years ago
Hello.
I use sikulixapi as java library. If a Finder instance does not have results yet, it's hard to clean it.
For example, the following code throws NullPointerException:
Finder finder = new Finder(); finder.destroy();
The culpit is this line (the link refers to the latest commit): https://github.com/RaiMan/SikuliX-2014/blob/dd9bc05710fffb1280b7746e4b3c11bc726940dd/API/src/main/java/org/sikuli/script/Finder.java#L139
What makes the situation a bit worse is that destroy() method is used in Finder.finalize(): https://github.com/RaiMan/SikuliX-2014/blob/dd9bc05710fffb1280b7746e4b3c11bc726940dd/API/src/main/java/org/sikuli/script/Finder.java#L153
Add a simple check that checks _results for null before running _results.delete() in Finder.destroy() method.
Thanks for finding. fixed 1.1.2 (2017-05-09, Travis build 37)
Hello.
I use sikulixapi as java library. If a Finder instance does not have results yet, it's hard to clean it.
For example, the following code throws NullPointerException:
The culpit is this line (the link refers to the latest commit): https://github.com/RaiMan/SikuliX-2014/blob/dd9bc05710fffb1280b7746e4b3c11bc726940dd/API/src/main/java/org/sikuli/script/Finder.java#L139
What makes the situation a bit worse is that destroy() method is used in Finder.finalize(): https://github.com/RaiMan/SikuliX-2014/blob/dd9bc05710fffb1280b7746e4b3c11bc726940dd/API/src/main/java/org/sikuli/script/Finder.java#L153
Possible solution
Add a simple check that checks _results for null before running _results.delete() in Finder.destroy() method.