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:
Mark de Wever 2008-05-12 07:36:27 +00:00
parent d3524bd60b
commit 51f8b73e4b

View File

@ -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();