Added null check to two dimensional array

This commit is contained in:
erri120 2020-01-04 11:25:53 +01:00
parent d1049aaefe
commit 4cd200df98
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -291,14 +292,15 @@ namespace Wabbajack.Lib
{ {
try try
{ {
IniData data;
var parser = new FileIniDataParser(new IniDataParser(config)); var parser = new FileIniDataParser(new IniDataParser(config));
data = parser.ReadFile(file); var data = parser.ReadFile(file);
if (data.Sections["Display"] == null)
return;
if (data.Sections["Display"]["iSize W"] != null && data.Sections["Display"]["iSize H"] != null) if (data.Sections["Display"]["iSize W"] != null && data.Sections["Display"]["iSize H"] != null)
{ {
data.Sections["Display"]["iSize W"] = SystemParameters.PrimaryScreenWidth.ToString(); data.Sections["Display"]["iSize W"] = SystemParameters.PrimaryScreenWidth.ToString(CultureInfo.CurrentCulture);
data.Sections["Display"]["iSize H"] = SystemParameters.PrimaryScreenHeight.ToString(); data.Sections["Display"]["iSize H"] = SystemParameters.PrimaryScreenHeight.ToString(CultureInfo.CurrentCulture);
} }
parser.WriteFile(file, data); parser.WriteFile(file, data);
@ -308,7 +310,6 @@ namespace Wabbajack.Lib
Utils.Log($"Skipping screen size remap for {file} due to parse error."); Utils.Log($"Skipping screen size remap for {file} due to parse error.");
continue; continue;
} }
} }
} }