chore: throw in LoadImage/Raw if scene isn't ready

This commit is contained in:
goaaats 2022-06-25 17:26:34 +02:00
parent a43d9665d0
commit cccf69c001
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -284,6 +284,9 @@ namespace Dalamud.Interface.Internal
/// <returns>A texture, ready to use in ImGui.</returns>
public TextureWrap? LoadImage(string filePath)
{
if (this.scene == null)
throw new InvalidOperationException("Scene isn't ready.");
try
{
return this.scene?.LoadImage(filePath) ?? null;
@ -303,6 +306,9 @@ namespace Dalamud.Interface.Internal
/// <returns>A texture, ready to use in ImGui.</returns>
public TextureWrap? LoadImage(byte[] imageData)
{
if (this.scene == null)
throw new InvalidOperationException("Scene isn't ready.");
try
{
return this.scene?.LoadImage(imageData) ?? null;
@ -325,6 +331,9 @@ namespace Dalamud.Interface.Internal
/// <returns>A texture, ready to use in ImGui.</returns>
public TextureWrap? LoadImageRaw(byte[] imageData, int width, int height, int numChannels)
{
if (this.scene == null)
throw new InvalidOperationException("Scene isn't ready.");
try
{
return this.scene?.LoadImageRaw(imageData, width, height, numChannels) ?? null;