[1.1.4] possible NPE: multi-monitor: initScreens: mouse check

Bug #1818043 reported by Ronny on 2019-02-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sikuli
Undecided
Unassigned

Bug Description

Hi,

I use 3 monitors in win 7 with sikulix-api 1.1.4 (This version was built at 2019-02-27_17:37 (Build 212) )

now if i start a new screen (screen = new Screen() ). I get a NullPointerException if my Mouse is in the 3rd Screen (windows screencounting) in the middle of the monitors. Is the mouse at this time on Screen 1 oder 3 (right and left outside) is all fine...

The code is simple:

public ScreenRobot() {
    screen = new Screen();

Exception in thread "main" java.lang.NullPointerException
 at org.sikuli.script.Location.getScreen(Location.java:130)
 at org.sikuli.script.Mouse.move(Mouse.java:391)
 at org.sikuli.script.Mouse.move(Mouse.java:372)
 at org.sikuli.script.Mouse.init(Mouse.java:60)
 at org.sikuli.script.Screen.initScreens(Screen.java:136)
 at org.sikuli.script.Screen.<init>(Screen.java:169)
 at de.sm.ScreenRobot.<init>(ScreenRobot.java:31)

RaiMan (raimund-hocke) wrote :

please use:

public ScreenRobot() {
    Debug.on(3)
    screen = new Screen();

and analyse/post the log

summary: - NullPointerException in new Screen() if mouse is on second screen
+ [1.1.4] possible NPE: multi-monitor: initScreens: mouse check
RaiMan (raimund-hocke) wrote :

... I currently do not have any multi-monitor environment available, sorry.

Ronny (technikman) wrote :

Hi,

Log:
[debug] Screen: initScreens: starting
[debug] Screen: Accessing: GraphicsEnvironment.getLocalGraphicsEnvironment()
[debug] Screen: Accessing: GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()
[debug] Screen: ScreenDevice 0 has (0,0) --- will be primary Screen(0)
[debug] Screen: Monitor 0: (0, 0) 1920 x 1200
[debug] Screen: Monitor 1: (3600, 247) 1366 x 768
[debug] Screen: Monitor 2: (1920, 35) 1680 x 1050
[debug] Mouse: init start
Exception in thread "main" java.lang.NullPointerException
 at org.sikuli.script.Location.getScreen(Location.java:130)
 at org.sikuli.script.Mouse.move(Mouse.java:391)
 at org.sikuli.script.Mouse.move(Mouse.java:372)
 at org.sikuli.script.Mouse.init(Mouse.java:60)
 at org.sikuli.script.Screen.initScreens(Screen.java:136)
 at org.sikuli.script.Screen.<init>(Screen.java:169)
 at sikulixtest.SikulixTest.main(SikulixTest.java:10)

Code:

package sikulixtest;

import org.sikuli.basics.Debug;
import org.sikuli.script.Screen;

public class SikulixTest {

    public static void main(String[] args) {
        Debug.on(3);
        Screen screen = new Screen();
    }
}

my mouse is on [debug] Screen: Monitor 2: (1920, 35) 1680 x 1050

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers