Fix another segfault error. Bump version to 6.4.3

This commit is contained in:
Eric Fredricksen
2022-01-20 20:55:14 -08:00
parent a2ae462d30
commit 047dc7463c
3 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ object FrontForm: TFrontForm
Height = 13 Height = 13
Align = alBottom Align = alBottom
Alignment = taCenter Alignment = taCenter
Caption = #169' 2002-2022 Eric Fredricksen - v6.4.2' Caption = #169' 2002-2022 Eric Fredricksen - v6.4.3'
Color = clWhite Color = clWhite
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = 11382189 Font.Color = 11382189
+7 -1
View File
@@ -3,7 +3,7 @@ unit Main;
{$UNDEF CHEATS} {$UNDEF CHEATS}
{$UNDEF LOGGING} {$UNDEF LOGGING}
{$UNDEF TURBO} {$DEFINE TURBO}
interface interface
@@ -841,11 +841,17 @@ begin
t := 0; t := 0;
for i := 0 to 5 do Inc(t,Square(GetI(Stats,i))); for i := 0 to 5 do Inc(t,Square(GetI(Stats,i)));
t := Random(t); t := Random(t);
// High stats cause int overflow
if t < 0 then i := Random(Stats.Items.Count) if t < 0 then i := Random(Stats.Items.Count)
else begin else begin
i := -1; i := -1;
while t >= 0 do begin while t >= 0 do begin
Inc(i); Inc(i);
if i >= Stats.Items.Count then begin
// This happens with high stats due to integer overflow
i := Random(Stats.Items.Count);
break;
end;
Dec(t,Square(GetI(Stats,i))); Dec(t,Square(GetI(Stats,i)));
end; end;
end; end;
BIN
View File
Binary file not shown.