From dd95bc225f332c3c8ad23db55b3600b75e9511f1 Mon Sep 17 00:00:00 2001 From: lempamo Date: Tue, 28 Feb 2017 12:27:16 -0500 Subject: [PATCH] found a NRE --- ShiftOS.WinForms/Applications/Snakey.cs | 10 ++++++---- ShiftOS_TheReturn/Shiftorium.cs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ShiftOS.WinForms/Applications/Snakey.cs b/ShiftOS.WinForms/Applications/Snakey.cs index f210c9c..2f01b88 100644 --- a/ShiftOS.WinForms/Applications/Snakey.cs +++ b/ShiftOS.WinForms/Applications/Snakey.cs @@ -51,7 +51,9 @@ namespace ShiftOS.WinForms.Applications } } - int headX = int.Parse(head.Name.Split('b')[1]); + if (head == null) return; + + int headX = int.Parse(head.Name.Split('b')[1]); // NRE was here int headY = int.Parse(head.Name.Split('b')[2]); int newHeadX = headX; @@ -157,14 +159,14 @@ namespace ShiftOS.WinForms.Applications } snakemap = new int[10, 10]; snakemap[5, 5] = 2; - tableLayoutPanel1.GetControlFromPosition(5, 5).BackgroundImage = Properties.Resources.SnakeyHeadL; + ((PictureBox)tableLayoutPanel1.GetControlFromPosition(5, 5)).Image = Properties.Resources.SnakeyHeadL; for (int x = 6; x < 8; x++) { snakemap[x, 5] = 1; - tableLayoutPanel1.GetControlFromPosition(x, 5).BackgroundImage = Properties.Resources.SnakeyBody; + ((PictureBox)tableLayoutPanel1.GetControlFromPosition(x, 5)).Image = Properties.Resources.SnakeyBody; } snakemap[8, 5] = 3; - tableLayoutPanel1.GetControlFromPosition(8, 5).BackgroundImage = Properties.Resources.SnakeyTailL; + ((PictureBox)tableLayoutPanel1.GetControlFromPosition(8, 5)).Image = Properties.Resources.SnakeyTailL; snakeupdater.Start(); } diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index e6fc299..ab95f43 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -208,9 +208,9 @@ namespace ShiftOS.Engine } catch { - return false; Console.WriteLine("Upgrade " + id + "DNE."); Console.WriteLine(); + return false; } }