mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Catch exception while moving cursor in ConsoleIO
- ConsoleIO bug report by ibspa. - Also: NullReferenceException when closing connection
This commit is contained in:
parent
a5bf62bc94
commit
e8a8ca4e7a
2 changed files with 23 additions and 11 deletions
|
|
@ -338,15 +338,21 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
if (buffer.Length > 0)
|
if (buffer.Length > 0)
|
||||||
{
|
{
|
||||||
if (Console.CursorLeft == 0)
|
try
|
||||||
{
|
{
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
if (Console.CursorLeft == 0)
|
||||||
Console.CursorTop--;
|
{
|
||||||
Console.Write(' ');
|
Console.CursorLeft = Console.BufferWidth - 1;
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
if (Console.CursorTop > 0)
|
||||||
Console.CursorTop--;
|
Console.CursorTop--;
|
||||||
|
Console.Write(' ');
|
||||||
|
Console.CursorLeft = Console.BufferWidth - 1;
|
||||||
|
if (Console.CursorTop > 0)
|
||||||
|
Console.CursorTop--;
|
||||||
|
}
|
||||||
|
else Console.Write("\b \b");
|
||||||
}
|
}
|
||||||
else Console.Write("\b \b");
|
catch (ArgumentOutOfRangeException) { /* Console was resized!? */ }
|
||||||
buffer = buffer.Substring(0, buffer.Length - 1);
|
buffer = buffer.Substring(0, buffer.Length - 1);
|
||||||
|
|
||||||
if (buffer2.Length > 0)
|
if (buffer2.Length > 0)
|
||||||
|
|
@ -358,12 +364,17 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
private static void GoBack()
|
private static void GoBack()
|
||||||
{
|
{
|
||||||
if (Console.CursorLeft == 0)
|
try
|
||||||
{
|
{
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
if (Console.CursorLeft == 0)
|
||||||
Console.CursorTop--;
|
{
|
||||||
|
Console.CursorLeft = Console.BufferWidth - 1;
|
||||||
|
if (Console.CursorTop > 0)
|
||||||
|
Console.CursorTop--;
|
||||||
|
}
|
||||||
|
else Console.Write('\b');
|
||||||
}
|
}
|
||||||
else Console.Write('\b');
|
catch (ArgumentOutOfRangeException) { /* Console was resized!? */ }
|
||||||
}
|
}
|
||||||
private static void GoLeft()
|
private static void GoLeft()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
|
catch (NullReferenceException) { return false; }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue