The documentation of ProgressBarStyle says knobBefore is optional, but not setting it/null will result in a crash because the ProgressBar does this in draw(Batch, float):
if (min != max) {
if (knob == null) {
knobWidthHalf = knobBefore.getMinWidth() * 0.5f; // knobBefore may be null here
// code ...
} else {
// code ...
}
// code ...
}
if (knobBefore != null) { // if it was really null it already crashed here
// code ...
}
Either knobBefore has to be required in which case that should be corrected in the documentation or it should really be made optional. In my humble opinion it should be optional because the Slider, a subclass of ProgressBar as you know, should not require knobBefore.
Also a side note that's not worth opening another issue:
The ProgressBarStyle copy constructor does not copy all variables but just background and knobBefore. Not sure if that's on purpose, but in my opinion this is unexpected behavior.
The documentation of
ProgressBarStylesaysknobBeforeis optional, but not setting it/null will result in a crash because theProgressBardoes this indraw(Batch, float):Either
knobBeforehas to be required in which case that should be corrected in the documentation or it should really be made optional. In my humble opinion it should be optional because theSlider, a subclass ofProgressBaras you know, should not requireknobBefore.Also a side note that's not worth opening another issue:
The
ProgressBarStylecopy constructor does not copy all variables but justbackgroundandknobBefore. Not sure if that's on purpose, but in my opinion this is unexpected behavior.