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 Aug 7, 2022
2 parents a1ae411 + e2ffdbd commit 49aae75
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 @@ -146,6 +146,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 49aae75

Please sign in to comment.