From a79231f9f930f342bf19db1cef46a200d6000526 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sat, 6 Aug 2011 16:54:04 +0200 Subject: [PATCH] Catch exception in lines --- changes.txt | 2 +- src/modules/filesystem/physfs/wrap_Filesystem.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changes.txt b/changes.txt index 21d59c7bf..183519c28 100644 --- a/changes.txt +++ b/changes.txt @@ -37,7 +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. + * Fixed crashes when operating on non-existent files. * Renamed SpriteBatch's lock/unlock to bind/unbind. diff --git a/src/modules/filesystem/physfs/wrap_Filesystem.cpp b/src/modules/filesystem/physfs/wrap_Filesystem.cpp index dfbfc0a8e..6786b90ed 100644 --- a/src/modules/filesystem/physfs/wrap_Filesystem.cpp +++ b/src/modules/filesystem/physfs/wrap_Filesystem.cpp @@ -221,7 +221,14 @@ namespace physfs int w_lines(lua_State * L) { - return instance->lines(L); + try + { + return instance->lines(L); + } + catch (Exception &e) + { + return luaL_error(L, e.what()); + } } int w_load(lua_State * L)