Lua - gui.drawImage(), gui.drawImageRegion() - log an error if image can not be found, instead of throwing an exception

This commit is contained in:
adelikat 2016-11-19 14:10:17 -06:00
parent a413f524c9
commit b7a6542fb6
1 changed files with 13 additions and 2 deletions

View File

@ -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;