Mouse location throws NullPointerException
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
New
|
Undecided
|
Unassigned |
Bug Description
1. The version of Sikuli you were using.
2.0.5
2. Your operating system, 32-bit or 64-bit, and its version.
MS Windows 11, 64-bit
3. The procedure to reproduce the bug.
Mouse.
4. Any information that might help us to locate the bug.
See below :-)
I'm using Jython with Sikulix, and am trying to get information about the Mouse location with a call such as this:
mouse_off_scr = scr.getBounds(
However, this frequently results in a NullPointerExce
public Location getLocation() {
PointerInfo mp = MouseInfo.
if (mp != null) {
return new Location(
} else {
Debug.
return null;
}
}
It looks like there is some code in place to avoid the NPE. Even though it's checking for a null return value from MouseInfo.
public Location getLocation() {
PointerInfo mp = MouseInfo.
if (mp != null) {
return new Location(
} else {
Debug.
return null;
}
}
That may result is very slightly "outdated" mouse information, but at least it would avoid crashing the program. :-)