LCL: fixed crash when poMainFormCenter if there is no mainform

git-svn-id: trunk@24781 -
This commit is contained in:
mattias 2010-04-21 07:35:51 +00:00
parent 2e66a93ebd
commit 612e69dc4a

View File

@ -1133,6 +1133,7 @@ procedure TCustomForm.MoveToDefaultPosition;
var
X, Y : integer;
p: TPosition;
begin
if (Parent = nil) and (ParentWindow = 0) then
begin
@ -1140,7 +1141,10 @@ begin
X := Left;
Y := Top;
if (Position = poMainFormCenter)
p:=Position;
if (Position = poMainFormCenter) and (Application.Mainform=nil) then
p:=poScreenCenter;
if (P = poMainFormCenter)
and (FormStyle = fsMDIChild)
and (Self <> Application.Mainform)
then begin
@ -1148,7 +1152,7 @@ begin
Y := (Application.Mainform.ClientHeight - Height) div 2;
end
else begin
case Position of
case P of
poDesktopCenter :
begin
X := (Screen.DesktopWidth - Width) div 2;