Don't throw an exception when creating a hardware cursor fails
This commit is contained in:
@@ -45,9 +45,6 @@ namespace OpenRA.Platforms.Default
|
||||
// This call very occasionally fails on Windows, but often works when retried.
|
||||
for (var retries = 0; retries < 3 && Cursor == IntPtr.Zero; retries++)
|
||||
Cursor = SDL.SDL_CreateColorCursor(surface, hotspot.X, hotspot.Y);
|
||||
|
||||
if (Cursor == IntPtr.Zero)
|
||||
throw new Sdl2HardwareCursorException($"Failed to create cursor: {SDL.SDL_GetError()}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -344,11 +344,14 @@ namespace OpenRA.Platforms.Default
|
||||
hotspot *= 2;
|
||||
}
|
||||
|
||||
return new Sdl2HardwareCursor(size, data, hotspot);
|
||||
var cursor = new Sdl2HardwareCursor(size, data, hotspot);
|
||||
return cursor.Cursor == IntPtr.Zero ? null : cursor;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Sdl2HardwareCursorException($"Failed to create hardware cursor `{name}` - {ex.Message}", ex);
|
||||
Log.Write("debug", $"Failed to create hardware cursor `{name}` - {ex.Message}");
|
||||
Console.WriteLine($"Failed to create hardware cursor `{name}` - {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user