summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-04-04 19:54:37 +0200
committerErich Eckner <git@eckner.net>2020-04-04 19:54:37 +0200
commit68249f7c331950965e8764af06623aca2cb58a2a (patch)
tree2c0c3786536e220a141708be7c4e11a6db06249a
parent934fe828ac182cda938937debc36c47905ea08b2 (diff)
downloadRaetsel-68249f7c331950965e8764af06623aca2cb58a2a.tar.xz
raetselunit.pas: do not query properties of uninitialized objects
-rw-r--r--raetsel.lps98
-rw-r--r--raetselunit.pas28
2 files changed, 69 insertions, 57 deletions
diff --git a/raetsel.lps b/raetsel.lps
index 65586a3..b73d731 100644
--- a/raetsel.lps
+++ b/raetsel.lps
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
- <Version Value="10"/>
+ <Version Value="11"/>
<BuildModes Active="linux_64bits"/>
<Units Count="20">
<Unit0>
@@ -38,16 +38,16 @@
<Unit3>
<Filename Value="raetselunit.pas"/>
<IsPartOfProject Value="True"/>
+ <IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
- <TopLine Value="872"/>
- <CursorPos X="30" Y="904"/>
+ <TopLine Value="669"/>
+ <CursorPos X="5" Y="684"/>
<UsageCount Value="59"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="raetselunit.inc"/>
<IsPartOfProject Value="True"/>
- <IsVisibleTab Value="True"/>
<EditorIndex Value="6"/>
<TopLine Value="260"/>
<CursorPos Y="277"/>
@@ -163,125 +163,129 @@
</OtherDefines>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
- <Filename Value="../units/mystringlistunit.pas"/>
- <Caret Line="58" Column="59" TopLine="22"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="405" Column="38" TopLine="393"/>
</Position1>
<Position2>
- <Filename Value="../units/matheunit.pas"/>
- <Caret Line="8" Column="71"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="406" Column="31" TopLine="393"/>
</Position2>
<Position3>
- <Filename Value="../units/matheunit.pas"/>
- <Caret Line="48" TopLine="23"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="407" Column="14" TopLine="393"/>
</Position3>
<Position4>
<Filename Value="raetselunit.pas"/>
- <Caret Line="812" Column="77" TopLine="787"/>
+ <Caret Line="408" Column="14" TopLine="393"/>
</Position4>
<Position5>
<Filename Value="raetselunit.pas"/>
- <Caret Line="78" Column="14" TopLine="55"/>
+ <Caret Line="413" Column="19" TopLine="393"/>
</Position5>
<Position6>
<Filename Value="raetselunit.pas"/>
- <Caret Line="404" Column="22" TopLine="393"/>
+ <Caret Line="419" Column="46" TopLine="393"/>
</Position6>
<Position7>
<Filename Value="raetselunit.pas"/>
- <Caret Line="405" Column="38" TopLine="393"/>
+ <Caret Line="423" Column="30" TopLine="396"/>
</Position7>
<Position8>
<Filename Value="raetselunit.pas"/>
- <Caret Line="406" Column="31" TopLine="393"/>
+ <Caret Line="89" Column="29" TopLine="69"/>
</Position8>
<Position9>
<Filename Value="raetselunit.pas"/>
- <Caret Line="407" Column="14" TopLine="393"/>
+ <Caret Line="423" Column="32" TopLine="391"/>
</Position9>
<Position10>
<Filename Value="raetselunit.pas"/>
- <Caret Line="408" Column="14" TopLine="393"/>
+ <Caret Line="464" Column="16" TopLine="438"/>
</Position10>
<Position11>
<Filename Value="raetselunit.pas"/>
- <Caret Line="413" Column="19" TopLine="393"/>
+ <Caret Line="92" Column="34" TopLine="72"/>
</Position11>
<Position12>
<Filename Value="raetselunit.pas"/>
- <Caret Line="419" Column="46" TopLine="393"/>
+ <Caret Line="448" Column="22" TopLine="416"/>
</Position12>
<Position13>
<Filename Value="raetselunit.pas"/>
- <Caret Line="423" Column="30" TopLine="396"/>
+ <Caret Line="464" Column="24" TopLine="432"/>
</Position13>
<Position14>
<Filename Value="raetselunit.pas"/>
- <Caret Line="89" Column="29" TopLine="69"/>
+ <Caret Line="544" Column="14" TopLine="513"/>
</Position14>
<Position15>
<Filename Value="raetselunit.pas"/>
- <Caret Line="423" Column="32" TopLine="391"/>
+ <Caret Line="101" Column="36" TopLine="83"/>
</Position15>
<Position16>
<Filename Value="raetselunit.pas"/>
- <Caret Line="464" Column="16" TopLine="438"/>
+ <Caret Line="544" Column="24" TopLine="512"/>
</Position16>
<Position17>
<Filename Value="raetselunit.pas"/>
- <Caret Line="92" Column="34" TopLine="72"/>
+ <Caret Line="895" Column="31" TopLine="872"/>
</Position17>
<Position18>
<Filename Value="raetselunit.pas"/>
- <Caret Line="448" Column="22" TopLine="416"/>
+ <Caret Line="896" Column="49" TopLine="872"/>
</Position18>
<Position19>
<Filename Value="raetselunit.pas"/>
- <Caret Line="464" Column="24" TopLine="432"/>
+ <Caret Line="900" Column="51" TopLine="872"/>
</Position19>
<Position20>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="544" Column="14" TopLine="513"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="392" Column="27" TopLine="373"/>
</Position20>
<Position21>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="101" Column="36" TopLine="83"/>
+ <Filename Value="raetselunit.inc"/>
</Position21>
<Position22>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="544" Column="24" TopLine="512"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="16" Column="36"/>
</Position22>
<Position23>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="895" Column="31" TopLine="872"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="283" Column="23" TopLine="249"/>
</Position23>
<Position24>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="896" Column="49" TopLine="872"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="279" Column="42" TopLine="259"/>
</Position24>
<Position25>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="900" Column="51" TopLine="872"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="277" TopLine="260"/>
</Position25>
<Position26>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="392" Column="27" TopLine="373"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="633" Column="3" TopLine="611"/>
</Position26>
<Position27>
- <Filename Value="raetselunit.inc"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="628" Column="35" TopLine="613"/>
</Position27>
<Position28>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="16" Column="36"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="620" TopLine="599"/>
</Position28>
<Position29>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="283" Column="23" TopLine="249"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="645" Column="3" TopLine="624"/>
</Position29>
<Position30>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="279" Column="42" TopLine="259"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="640" Column="36" TopLine="625"/>
</Position30>
</JumpHistory>
+ <RunParams>
+ <FormatVersion Value="2"/>
+ <Modes Count="0" ActiveMode="default"/>
+ </RunParams>
</ProjectSession>
<Debugging>
<Watches Count="7">
diff --git a/raetselunit.pas b/raetselunit.pas
index ad4a43a..6898c6c 100644
--- a/raetselunit.pas
+++ b/raetselunit.pas
@@ -611,12 +611,12 @@ begin
farbWahlFlaeche.width:=zeichenFlaeche.width;
zeichenFlaecheNeuKreieren;
besitzer.height:=besitzerHoehe;
- besitzer.width:=
- max(max(
- besitzerBreite,
- sudokuCB.left+sudokuCB.width+spacing),
- spinEdits[length(spinEdits)-1].left+spinEdits[length(spinEdits)-1].width+spacing
- );
+ besitzer.width:=besitzerBreite;
+ if assigned(sudokuCB) then
+ besitzer.width:=max(besitzer.width,sudokuCB.left+sudokuCB.width+spacing);
+ if length(spinEdits)>0 then
+ if assigned(spinEdits[length(spinEdits)-1]) then
+ besitzer.width:=max(besitzer.width,spinEdits[length(spinEdits)-1].left+spinEdits[length(spinEdits)-1].width+spacing);
progressBar1.width:=besitzer.width;
zeichnen;
end;
@@ -625,18 +625,24 @@ function tFelderRaetsel.besitzerHoehe: longint;
var
i: longint;
begin
- result:=max(inherited besitzerHoehe,diagonalenCB.top+diagonalenCB.height+spacing);
+ result:=inherited besitzerHoehe;
+ if assigned(diagonalenCB) then
+ result:=max(result,diagonalenCB.top+diagonalenCB.height+spacing);
for i:=0 to length(spinEdits)-1 do
- result:=max(result,spinEdits[i].top+spinEdits[i].height+spacing);
+ if assigned(spinEdits[i]) then
+ result:=max(result,spinEdits[i].top+spinEdits[i].height+spacing);
end;
function tFelderRaetsel.besitzerBreite: longint;
var
i: longint;
begin
- result:=max(inherited besitzerBreite,diagonalenCB.left+diagonalenCB.width+spacing);;
+ result:=inherited besitzerBreite;
+ if assigned(diagonalenCB) then
+ result:=max(result,diagonalenCB.left+diagonalenCB.width+spacing);
for i:=0 to length(spinEdits)-1 do
- result:=max(result,spinEdits[i].left+spinEdits[i].width+spacing);
+ if assigned(spinEdits[i]) then
+ result:=max(result,spinEdits[i].left+spinEdits[i].width+spacing);
end;
procedure tFelderRaetsel.schreibeZentriert(x,y,i: longint);
@@ -674,6 +680,8 @@ procedure tFelderRaetsel.zeichnen;
var
i: longint;
begin
+ if not assigned(sudokuCB) then
+ exit;
zeichenFlaeche.canvas.brush.color:=$ffffff;
zeichenFlaeche.canvas.rectangle(-10,-10,zeichenFlaeche.width+10,zeichenFlaeche.height+10);
zeichenFlaeche.canvas.pen.width:=3-2*byte(sudokuCB.checked);