~jpgleeson/spawsh

0824c3d798f4f4a42dc5c5e6618daf13b5879bd6 — Jack Gleeson 7 months ago 6c6b458
FIX: Fixed crash on host that can't be found

Null checks to prevent this.
1 files changed, 22 insertions(+), 11 deletions(-)

M Program.cs
M Program.cs => Program.cs +22 -11
@@ 112,17 112,20 @@ namespace spawsh

            for (int i = 1; i < LineBuffer.Length; i++)
            {
                if (LineBuffer[i].Length < Console.WindowWidth)
                if (LineBuffer[i] != null)
                {
                    Console.WriteLine(LineBuffer[i]);
                }
                else if (LineBuffer[i].Substring(0, 2) == "=>")
                {
                    Console.WriteLine(LineBuffer[i]);
                }
                else
                {
                    lineWrapString(LineBuffer[i]);
                    if (LineBuffer[i].Length < Console.WindowWidth)
                    {
                        Console.WriteLine(LineBuffer[i]);
                    }
                    else if (LineBuffer[i].Substring(0, 2) == "=>")
                    {
                        Console.WriteLine(LineBuffer[i]);
                    }
                    else
                    {
                        lineWrapString(LineBuffer[i]);
                    }
                }
            }



@@ 160,7 163,15 @@ namespace spawsh

                    LineBuffer = fetchedPage;

                    linksInPage = buildLinkSet(LineBuffer);
                    if (LineBuffer[0] == "No such host is known.")
                    {

                    }
                    else
                    {
                        linksInPage = buildLinkSet(LineBuffer);
                    }
                    

                    selectedLinkIndex = -1;
                }