Update CollapsingLayouter to fix crashes in a few applications. All these crashes were related to empty layouts. Fixes some of #7446
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41256 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4d9ffa5ff9
commit
5e5a8daf68
@ -195,7 +195,7 @@ float
|
||||
CollapsingLayouter::MinSize()
|
||||
{
|
||||
_ValidateLayouter();
|
||||
return fLayouter->MinSize();
|
||||
return fLayouter ? fLayouter->MinSize() : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ float
|
||||
CollapsingLayouter::MaxSize()
|
||||
{
|
||||
_ValidateLayouter();
|
||||
return fLayouter->MaxSize();
|
||||
return fLayouter ? fLayouter->MaxSize() : B_SIZE_UNLIMITED;
|
||||
}
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ float
|
||||
CollapsingLayouter::PreferredSize()
|
||||
{
|
||||
_ValidateLayouter();
|
||||
return fLayouter->PreferredSize();
|
||||
return fLayouter ? fLayouter->PreferredSize() : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -220,7 +220,8 @@ CollapsingLayouter::CreateLayoutInfo()
|
||||
{
|
||||
_ValidateLayouter();
|
||||
|
||||
return new ProxyLayoutInfo(fLayouter->CreateLayoutInfo(), fElementCount);
|
||||
LayoutInfo* info = fLayouter ? fLayouter->CreateLayoutInfo() : NULL;
|
||||
return new ProxyLayoutInfo(info, fElementCount);
|
||||
}
|
||||
|
||||
|
||||
@ -328,6 +329,9 @@ CollapsingLayouter::_AddConstraints(int32 position, const Constraint* c)
|
||||
void
|
||||
CollapsingLayouter::_SetWeights()
|
||||
{
|
||||
if (!fLayouter)
|
||||
return;
|
||||
|
||||
for (int32 i = 0; i < fElementCount; i++) {
|
||||
fLayouter->SetWeight(fElements[i].position, fElements[i].weight);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user