From e3e4ae17d8813008cdd558727d02610fb6aca148 Mon Sep 17 00:00:00 2001 From: Bill Meltsner Date: Wed, 2 Feb 2011 21:07:21 -0500 Subject: [PATCH] love.graphics.setFont no longer explodes when passed a nonexistent file (fixes issue #177) --- src/modules/graphics/opengl/wrap_Graphics.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 617e1509f..aded2d049 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -452,7 +452,12 @@ namespace opengl // Convert to Data, if necessary. if(luax_istype(L, 1, FILESYSTEM_FILE_T)) { love::filesystem::File * f = luax_checktype(L, 1, "File", FILESYSTEM_FILE_T); - Data * d = f->read(); + Data * d; + try { + d = f->read(); + } catch (love::Exception & e) { + return luaL_error(L, e.what()); + } lua_remove(L, 1); // get rid of the file luax_newtype(L, "Data", DATA_T, (void*)d); lua_insert(L, 1); // put it at the bottom of the stack