Prevent crash when no Data\Contacts.dat

This commit is contained in:
JappaWakka 2023-11-13 15:20:09 +01:00
parent d516a1e152
commit 3bd6f1af5b

View File

@ -1420,7 +1420,7 @@
Private Sub InitializePhone() Private Sub InitializePhone()
InitializedPhone = True InitializedPhone = True
If System.IO.File.Exists(GameModeManager.GetContentFilePath("Data\contacts.dat")) Then
Dim reg() As String = Core.Player.RegisterData.Split(CChar(",")) Dim reg() As String = Core.Player.RegisterData.Split(CChar(","))
Dim contactData() As String = System.IO.File.ReadAllLines(GameModeManager.GetContentFilePath("Data\contacts.dat")) Dim contactData() As String = System.IO.File.ReadAllLines(GameModeManager.GetContentFilePath("Data\contacts.dat"))
@ -1440,6 +1440,7 @@
Next Next
End If End If
Next Next
End If
PhoneContacts = (From c In PhoneContacts Order By c.ID Ascending).ToList() PhoneContacts = (From c In PhoneContacts Order By c.ID Ascending).ToList()
End Sub End Sub
@ -1507,6 +1508,9 @@
If Core.CurrentScreen.Identification <> Identifications.OverworldScreen Then If Core.CurrentScreen.Identification <> Identifications.OverworldScreen Then
Exit Sub Exit Sub
End If End If
If System.IO.File.Exists(GameModeManager.GetContentFilePath("Data\contacts.dat")) = False Then
Exit Sub
End If
Dim reg() As String = Core.Player.RegisterData.Split(CChar(",")) Dim reg() As String = Core.Player.RegisterData.Split(CChar(","))