diff --git a/changes.txt b/changes.txt index af28d43b4..21d59c7bf 100644 --- a/changes.txt +++ b/changes.txt @@ -37,6 +37,7 @@ LOVE 0.8.0 [Rubber Piggy] * Fixed love.filesystem.lines() leaking. * Fixed Source controls inconsistencies. * Fixed most leaking on unclosed File objects. + * Fixed crash when File:getSize() was called on a non-existent file. * Renamed SpriteBatch's lock/unlock to bind/unbind. diff --git a/src/modules/filesystem/physfs/wrap_File.cpp b/src/modules/filesystem/physfs/wrap_File.cpp index f8649b31a..437dcc5f4 100644 --- a/src/modules/filesystem/physfs/wrap_File.cpp +++ b/src/modules/filesystem/physfs/wrap_File.cpp @@ -37,7 +37,14 @@ namespace physfs int w_File_getSize(lua_State * L) { File * t = luax_checkfile(L, 1); - lua_pushinteger(L, t->getSize()); + try + { + lua_pushinteger(L, t->getSize()); + } + catch (Exception & e) + { + return luaL_error(L, e.what()); + } return 1; }