Skip to content

Commit

Permalink
Fix NRE - I assumed GetEnvironmentVariable returns "", not null
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0ade committed Oct 26, 2017
1 parent 96a116d commit 9d559fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Helper/XnaToFnaHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ public static void ApplyChanges(GraphicsDeviceManager self) {
self.IsFullScreen = true;

int forceWidth;
if (int.TryParse(Environment.GetEnvironmentVariable("XNATOFNA_DISPLAY_WIDTH"), out forceWidth))
if (int.TryParse(Environment.GetEnvironmentVariable("XNATOFNA_DISPLAY_WIDTH") ?? "", out forceWidth))
self.PreferredBackBufferWidth = forceWidth;
int forceHeight;
if (int.TryParse(Environment.GetEnvironmentVariable("XNATOFNA_DISPLAY_HEIGHT"), out forceHeight))
if (int.TryParse(Environment.GetEnvironmentVariable("XNATOFNA_DISPLAY_HEIGHT") ?? "", out forceHeight))
self.PreferredBackBufferHeight = forceHeight;
string[] forceSize = Environment.GetEnvironmentVariable("XNATOFNA_DISPLAY_SIZE").Split('x');
string[] forceSize = (Environment.GetEnvironmentVariable("XNATOFNA_DISPLAY_SIZE") ?? "").Split('x');
if (forceSize.Length == 2) {
if (int.TryParse(forceSize[0], out forceWidth))
self.PreferredBackBufferWidth = forceWidth;
Expand Down

0 comments on commit 9d559fa

Please sign in to comment.