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
End Try
End Function
Private Function GetTablefromXML(ConfigPath As String)
Private Function GetTablefromXML(ConfigPath As String) As DataTable
Try
Dim oDataset As New DataSet
oDataset.ReadXml(ConfigPath)
Return oDataset.Tables(0)
Catch ex As Exception
MsgBox("Error in GetTablefromXML" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
Dim oDataTable = CreateConfigTable()
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 Function
Private Function CreateConfigTable() As DataTable