mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-21 18:48:44 +00:00
Avoid an assert when the scrollbar doesn't have a size yet...
...and setting a parameter forces a recalculation. set_size() also recalculates so we won't be shown before being recalculated.
This commit is contained in:
parent
d3524bd60b
commit
51f8b73e4b
@ -172,6 +172,12 @@ void tscrollbar_::load_config_extra()
|
||||
//! Updates the size of the scroll bar.
|
||||
void tscrollbar_::recalculate()
|
||||
{
|
||||
// We can be called before the size has been set up in that case we can't do
|
||||
// the proper recalcultion so stop before we die with an assert.
|
||||
if(!get_length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the available size for the slider to move.
|
||||
int available_length =
|
||||
get_length() - offset_before() - minimum_positioner_length() - offset_after();
|
||||
|
Loading…
x
Reference in New Issue
Block a user