When the program is running, an exception is thrown after a while, but the line of code that generated it is not indicated. After that, the interface stops responding, but another thread calmly continues its work. With that, after the first exception, it begins to repeat constantly. What is the problem?

the code is https://pastebin.com/VBcnBgpv

an exception:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344) at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:506) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490) at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191) at java.lang.Thread.run(Unknown Source) 
  • one
    I have terrible news for you: JavaFX classes are not thread-safe. When developing a multi-threaded program with a GUI, you need to be extremely careful and use libraries specifically designed for this. For JavaFX, this is javafx.concurrent. - Sergey Gornostaev
  • thanks a lot, I will understand. I did not even know about this - Oleg Rosdaybeda

0