Catch corrupt or empty config

This commit is contained in:
Jonathan Jenne 2019-02-27 16:18:19 +01:00
parent 316f6e68a3
commit 548e8db47f

View File

@ -116,14 +116,16 @@ Module ModuleMySettings
Return False Return False
End Try End Try
End Function End Function
Private Function GetTablefromXML(ConfigPath As String) Private Function GetTablefromXML(ConfigPath As String) As DataTable
Try Try
Dim oDataset As New DataSet Dim oDataset As New DataSet
oDataset.ReadXml(ConfigPath) oDataset.ReadXml(ConfigPath)
Return oDataset.Tables(0) Return oDataset.Tables(0)
Catch ex As Exception Catch ex As Exception
MsgBox("Error in GetTablefromXML" & vbNewLine & ex.Message, MsgBoxStyle.Critical) Dim oDataTable = CreateConfigTable()
Return Nothing oDataTable.WriteXml(GetUserConfigPath())
MsgBox("Fehler beim Laden der Konfiguration. Es wurde die Standard Konfiguration geladen. Fehler:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return oDataTable
End Try End Try
End Function End Function
Private Function CreateConfigTable() As DataTable Private Function CreateConfigTable() As DataTable