mirror of
https://github.com/love2d/love.git
synced 2026-08-20 20:49:54 +02:00
Fixed an uncaught exception in File:getSize
This commit is contained in:
@@ -51,7 +51,16 @@ File *luax_checkfile(lua_State *L, int idx)
|
|||||||
int w_File_getSize(lua_State *L)
|
int w_File_getSize(lua_State *L)
|
||||||
{
|
{
|
||||||
File *t = luax_checkfile(L, 1);
|
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.
|
// Push nil on failure or if size does not fit into a double precision floating-point number.
|
||||||
if (size == -1)
|
if (size == -1)
|
||||||
@@ -74,7 +83,7 @@ int w_File_open(lua_State *L)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lua_pushboolean(L, file->open(mode) ? 1 : 0);
|
luax_pushboolean(L, file->open(mode));
|
||||||
}
|
}
|
||||||
catch (love::Exception &e)
|
catch (love::Exception &e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user