Skip to content

Commit

Permalink
Prevent character overflow
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
maybegreat48 committed Jan 7, 2024
1 parent 24cd62c commit c6a44f3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions GTA V Script Decompiler/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,18 @@ public void ApplyVarAutoNames(VariableStorage storage, string prefix = "")

if (setNames.ContainsKey(name))
{
if (local.AutoName.GetNameCollisionBehavior() == AutoName.NameCollisionBehavior.AddNumberSuffix)
{
setNames[name]++;
name += setNames[name];
}
else if (local.AutoName.GetNameCollisionBehavior() == AutoName.NameCollisionBehavior.IncrementCharacter)
if (local.AutoName.GetNameCollisionBehavior() == AutoName.NameCollisionBehavior.IncrementCharacter && (name[^1] + (setNames[name]-1)) < 'z')
{
setNames[name]++;
var chr = name[^1];
chr += (char)(setNames[name] - 1);
name = chr.ToString(); // TODO
}
else
{
setNames[name]++;
name += setNames[name];
}
}
else
{
Expand Down

0 comments on commit c6a44f3

Please sign in to comment.