Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
[Toolkit.Graphics] Fixed exception at changing fullscreen state with …
Browse files Browse the repository at this point in the history
…adapters which don't have any output (for example, like WARP)
  • Loading branch information
ArtiomCiumac committed Jun 27, 2013
1 parent 5becd1b commit 6b25cdd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ public override bool IsFullScreen
#else

var outputIndex = PrefferedFullScreenOutputIndex;
var output = GraphicsDevice.Adapter.GetOutputAt(outputIndex);
var availableOutputs = GraphicsDevice.Adapter.OutputsCount;

// no outputs connected to the current graphics adapter
var output = availableOutputs == 0 ? null : GraphicsDevice.Adapter.GetOutputAt(outputIndex);

Output currentOutput = null;

Expand All @@ -102,7 +105,7 @@ public override bool IsFullScreen
swapChain.GetFullscreenState(out isCurrentlyFullscreen, out currentOutput);

// check if the current fullscreen monitor is the same as new one
if (isCurrentlyFullscreen == value && currentOutput != null && currentOutput.NativePointer == ((Output)output).NativePointer)
if (isCurrentlyFullscreen == value && output != null && currentOutput != null && currentOutput.NativePointer == ((Output)output).NativePointer)
return;
}
finally
Expand Down

0 comments on commit 6b25cdd

Please sign in to comment.