I've got the following code:
public void DrawInput(string ChatCurrent){
int uCursorTop;
int uCursorLeft;
uCursorLeft = Console.CursorLeft;
uCursorTop = Console.CursorTop;
Console.SetCursorPosition(0, uCursorTop);
Console.Write("> "+ChatCurrent+" ");
Console.SetCursorPosition(ChatCurrent.Length, uCursorTop);
}
Except for the final line, it behaves properly. The final line throws System.NullReferenceException: Object reference not set to an instance of an object
. The weird thing? Specifically, accessing ChatCurrent.Length
is what's making it fail. The line immediately before, which echoes the string's contents, works just fine.
What's going on?