From 4a49d56bbefdd1ce491e957024ea22aa41715e07 Mon Sep 17 00:00:00 2001 From: travi$ Date: Sun, 27 Mar 2022 21:15:40 +0300 Subject: [PATCH] Fix crash in some commands --- src/game/g_game.pas | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 7e30028..e16a366 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -5701,7 +5701,7 @@ begin begin if Length(p) = 2 then begin - a := Max(0, StrToInt(p[1])); + a := Max(0, StrToIntDef(p[1], 0)); g_GFX_SetMax(a) end else if Length(p) = 1 then @@ -5717,7 +5717,7 @@ begin begin if Length(p) = 2 then begin - a := Max(0, StrToInt(p[1])); + a := Max(0, StrToIntDef(p[1], 0)); g_Shells_SetMax(a) end else if Length(p) = 1 then @@ -5733,7 +5733,7 @@ begin begin if Length(p) = 2 then begin - a := Max(0, StrToInt(p[1])); + a := Max(0, StrToIntDef(p[1], 0)); g_Gibs_SetMax(a) end else if Length(p) = 1 then @@ -5749,7 +5749,7 @@ begin begin if Length(p) = 2 then begin - a := Max(0, StrToInt(p[1])); + a := Max(0, StrToIntDef(p[1], 0)); g_Corpses_SetMax(a) end else if Length(p) = 1 then @@ -7432,7 +7432,7 @@ begin begin if Length(p) = 2 then begin - a := WP_FIRST + StrToInt(p[1]) - 1; + a := WP_FIRST + StrToIntDef(p[1], 0) - 1; if (a >= WP_FIRST) and (a <= WP_LAST) then gSelectWeapon[0, a] := True end @@ -7451,7 +7451,7 @@ begin begin if Length(p) = 2 then begin - a := WP_FIRST + StrToInt(p[1]) - 1; + a := WP_FIRST + StrToIntDef(p[1], 0) - 1; b := ord(cmd[2]) - ord('1'); if (a >= WP_FIRST) and (a <= WP_LAST) then gSelectWeapon[b, a] := True -- 2.29.2