From d3e439982b65b4101aaad9889821da66348cce8b Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Fri, 4 Feb 2022 16:53:48 +1000 Subject: [PATCH] Add missing file existence check in `forms.drawIcon` --- .../tools/Lua/Libraries/FormsLuaLibrary.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/FormsLuaLibrary.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/FormsLuaLibrary.cs index f3ce74a9f1..54af9dcab7 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/FormsLuaLibrary.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/FormsLuaLibrary.cs @@ -677,6 +677,11 @@ namespace BizHawk.Client.EmuHawk "draws an Icon (.ico) file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")] public void DrawIcon(int componentHandle, string path, int x, int y, int? width = null, int? height = null) { + if (!File.Exists(path)) + { + LogOutputCallback($"File not found: {path}\nScript Terminated"); + return; + } try { var ptr = new IntPtr(componentHandle);