HanSolo / medusa

A JavaFX library for Gauges
Apache License 2.0
687 stars 129 forks source link

lcdDesign(LcdDesign.SECTIONS) generates exception #175

Closed denkovi1 closed 4 years ago

denkovi1 commented 5 years ago

With the current version, when I make this gauge: eu.hansolo.medusa.Gauge ldc_test = GaugeBuilder.create() .skinType(eu.hansolo.medusa.Gauge.SkinType.LCD) .title("FORWARD") .subTitle("Distance") .unit("cm") .decimals(1) .sectionsVisible(true) .lcdDesign(LcdDesign.SECTIONS) .maxMeasuredValueVisible(false) .minMeasuredValueVisible(false) .minValue(0) .maxValue(100)
.sections(new eu.hansolo.medusa.Section(5, 10, Color.RED)) .build();

It produces exception. With the previous version of Medusa (8.3) it worked and now I got this exception:

Aug 23, 2019 12:36:21 PM javafx.beans.binding.Bindings$1 computeValue WARNING: Exception while evaluating binding java.lang.NullPointerException at eu.hansolo.medusa.skins.LcdSkin.updateLcdDesign(LcdSkin.java:312) at eu.hansolo.medusa.skins.LcdSkin.handleEvents(LcdSkin.java:255) at eu.hansolo.medusa.skins.GaugeSkinBase.lambda$registerListeners$2(GaugeSkinBase.java:51) at eu.hansolo.medusa.Gauge.lambda$setupBinding$6(Gauge.java:5257) at javafx.beans.binding.Bindings$1.computeValue(Bindings.java:133) at javafx.beans.binding.BooleanBinding.get(BooleanBinding.java:157) at javafx.beans.binding.BooleanExpression.getValue(BooleanExpression.java:56) at javafx.beans.binding.BooleanBinding.getValue(BooleanBinding.java:60) at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:178) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) at javafx.beans.binding.BooleanBinding.invalidate(BooleanBinding.java:176) at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:51) at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:349) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:72) at javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:103) at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110) at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144) at javafx.stage.Window.setShowing(Window.java:922) at javafx.stage.Window.show(Window.java:937) at javafx.stage.Stage.show(Stage.java:259) at com.mycompany.drm_30.Controllers.Controller.show(Controller.java:18) at com.mycompany.drm_30.MainApp.start(MainApp.java:59) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294) 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(Thread.java:748)

HanSolo commented 4 years ago

Did some tests with the code you provided and it works without any problem.