From cccf69c0010c83383ff8e3c3d4206535dbf4cb52 Mon Sep 17 00:00:00 2001 From: goaaats Date: Sat, 25 Jun 2022 17:26:34 +0200 Subject: [PATCH] chore: throw in LoadImage/Raw if scene isn't ready --- Dalamud/Interface/Internal/InterfaceManager.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index da7575990..1c4410efa 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -284,6 +284,9 @@ namespace Dalamud.Interface.Internal /// A texture, ready to use in ImGui. 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 /// A texture, ready to use in ImGui. 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 /// A texture, ready to use in ImGui. 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;