Skip to content

Commit 6634e26

Browse files
subescroesch
authored andcommitted
Update InputState.java
Fix Issue #197 #197
1 parent 5009498 commit 6634e26

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

assertj-swing/src/main/java/org/assertj/swing/input/InputState.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,16 @@ public void update(@Nonnull AWTEvent event) {
109109
}
110110
if (inputEvent instanceof MouseEvent) {
111111
MouseEvent mouseEvent = (MouseEvent) inputEvent;
112-
Point eventScreenLocation = screenLocation(mouseEvent);
113-
synchronized (this) {
114-
lastEventTime(mouseEvent);
115-
dragDropInfo.update(mouseEvent);
116-
mouseInfo.modifiers(modifiers);
117-
mouseInfo.update(mouseEvent, eventScreenLocation);
118-
modifiers(mouseInfo.modifiers());
112+
//TrayIcon might post events without a component
113+
if(mouseEvent.getComponent() != null) {
114+
Point eventScreenLocation = screenLocation(mouseEvent);
115+
synchronized (this) {
116+
lastEventTime(mouseEvent);
117+
dragDropInfo.update(mouseEvent);
118+
mouseInfo.modifiers(modifiers);
119+
mouseInfo.update(mouseEvent, eventScreenLocation);
120+
modifiers(mouseInfo.modifiers());
121+
}
119122
}
120123
}
121124
}

0 commit comments

Comments
 (0)