Skip to content

Commit

Permalink
Fix for OoR exception on SetCursorPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioDePau committed Jul 14, 2023
1 parent 7010ff0 commit 28a341f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public static class Helpers{
public static void UpdateLine(string text){
int paddingLength = Console.BufferWidth - text.Length;
string padding = new String(' ', paddingLength);
Console.SetCursorPosition(0, Console.CursorTop - 1);
int top = Math.Max(0, Console.CursorTop - 1);
Console.SetCursorPosition(0, top);
Console.Write($"{text}{padding}");
}

Expand Down

0 comments on commit 28a341f

Please sign in to comment.