From b7a6542fb60793ceb9090e5d6e18932545d4f8cb Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 19 Nov 2016 14:10:17 -0600 Subject: [PATCH] Lua - gui.drawImage(), gui.drawImageRegion() - log an error if image can not be found, instead of throwing an exception --- .../tools/Lua/Libraries/EmuLuaLibrary.Gui.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs index 0fcfc0c2a7..b77cae8108 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; using System.Drawing; -using System.Drawing.Drawing2D; -using System.Globalization; +using System.IO; using LuaInterface; @@ -358,6 +357,12 @@ namespace BizHawk.Client.EmuHawk )] public void DrawImage(string path, int x, int y, int? width = null, int? height = null) { + if (!File.Exists(path)) + { + Log("File not found: " + path); + return; + } + using (var g = GetGraphics()) { Image img; @@ -381,6 +386,12 @@ namespace BizHawk.Client.EmuHawk )] public void DrawImageRegion(string path, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int? dest_width = null, int? dest_height = null) { + if (!File.Exists(path)) + { + Log("File not found: " + path); + return; + } + using (var g = GetGraphics()) { Image img;