NullPointerException in WindowClose event in vaadin 8.10.3

I have added null check in Close event Listener for event. Still I am getting below exception at logs:

com.vaadin.event.ListenerMethod$MethodException: Invocation of method windowClose failed.
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:519) ~[!/:8.10.3]
 
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:273) ~[!/:8.10.3]
 
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:237) ~[!/:8.10.3]
 
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1014) ~[!/:8.10.3]
 
at com.vaadin.ui.Window.fireClose(Window.java:552) ~[!/:8.10.3]
 
at com.vaadin.ui.UI.removeWindow(UI.java:619) ~[!/:8.10.3]
 
at com.vaadin.ui.Window.close(Window.java:269) ~[!/:8.10.3]


Caused by: java.lang.NullPointerException at windowClose ~[!/:?]
 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_265]
 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_265]
 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_265]
 
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_265]
 
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:499) ~[!/:8.10.3]

There is new Window.CloseEvent object created in Window.fireClose() and that object is passed to fireEvent(), in ListenerMethod.receiveEvent() at invocation of windowClose the object is null.

Can you create a small self-contained example? I don’t understand what’s going on based on the error stack trace only.