From 3b532fdb706283b2a550ef717a58f1398ed51380 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 18 Nov 2013 05:29:53 -0400 Subject: [PATCH] Fixed an uncaught exception in File:getSize --- src/modules/filesystem/physfs/wrap_File.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/filesystem/physfs/wrap_File.cpp b/src/modules/filesystem/physfs/wrap_File.cpp index b4b3c47a9..afd8d2dc5 100644 --- a/src/modules/filesystem/physfs/wrap_File.cpp +++ b/src/modules/filesystem/physfs/wrap_File.cpp @@ -51,7 +51,16 @@ File *luax_checkfile(lua_State *L, int idx) int w_File_getSize(lua_State *L) { File *t = luax_checkfile(L, 1); - int64 size = t->getSize(); + + int64 size = -1; + try + { + size = t->getSize(); + } + catch (love::Exception &e) + { + return luax_ioError(L, "%s", e.what()); + } // Push nil on failure or if size does not fit into a double precision floating-point number. if (size == -1) @@ -74,7 +83,7 @@ int w_File_open(lua_State *L) try { - lua_pushboolean(L, file->open(mode) ? 1 : 0); + luax_pushboolean(L, file->open(mode)); } catch (love::Exception &e) {