From 8f1843a04293d205aa3e9c32a8179b28a207ee1f Mon Sep 17 00:00:00 2001 From: jianmingyong Date: Fri, 30 Sep 2016 04:16:55 +0800 Subject: [PATCH] Fix missing null exception checks for roaming pokes. --- 2.5DHero/2.5DHero/Screens/MapScreen.vb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/2.5DHero/2.5DHero/Screens/MapScreen.vb b/2.5DHero/2.5DHero/Screens/MapScreen.vb index ee5716396..24114c2c9 100644 --- a/2.5DHero/2.5DHero/Screens/MapScreen.vb +++ b/2.5DHero/2.5DHero/Screens/MapScreen.vb @@ -251,8 +251,11 @@ If TempPoke.Count > 0 And RoamingPokeName.Count > 0 Then For Each Pokes As String In RoamingPokeName - Dim MapObject As Roaming = (From p As Roaming In TempPoke Where p.Name = Pokes Order By p.Distance Ascending).ElementAt(TempPoke(0).getSkipIndex) - RoamingPoke.Add(MapObject) + Dim MapObject As List(Of Roaming) = (From p As Roaming In TempPoke Where p.Name = Pokes Order By p.Distance Ascending).ToList() + + If MapObject IsNot Nothing AndAlso Not MapObject.Count = 0 Then + RoamingPoke.Add(MapObject.ElementAt(MapObject(0).getSkipIndex)) + End If Next End If End Sub