From f580341afff74ffe14fd1e79a83e31b2c129cd2f Mon Sep 17 00:00:00 2001 From: Firew0lf Date: Fri, 21 Aug 2015 21:18:41 +0200 Subject: [PATCH] Fixed #1 "gfx.texture.load()" with a bad file name now return "nil" and an error. --- source/texture.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/texture.c b/source/texture.c index d1d9ade..f89cf06 100644 --- a/source/texture.c +++ b/source/texture.c @@ -40,6 +40,12 @@ static int texture_load(lua_State *L) { return 2; } + if (texture->texture == NULL) { + lua_pushnil(L); + lua_pushstring(L, "No such file"); + return 2; + } + texture->scaleX = 1.0f; texture->scaleY = 1.0f;