Skip to content

Commit

Permalink
Merge pull request #8569 from hez2010/visual-fixes
Browse files Browse the repository at this point in the history
Avoid crashing when fail to create OpenGL context
  • Loading branch information
maxkatz6 authored and danwalmsley committed Aug 12, 2022
1 parent 5f9c852 commit 7eb0a48
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Avalonia.OpenGL/Controls/OpenGlControlBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ private bool EnsureInitializedCore()
return false;
}

if (_context == null)
{
Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log("OpenGlControlBase",
"Unable to initialize OpenGL: unable to create additional OpenGL context.");
return false;
}

GlVersion = _context.Version;
try
{
Expand Down

0 comments on commit 7eb0a48

Please sign in to comment.