Commits

Alex Szpakowski committed 1142ba1

Fixed an uncaught exception in File:getSize

Comments (0)

Files changed (1)

src/modules/filesystem/physfs/wrap_File.cpp

 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)
 
 	try
 	{
-		lua_pushboolean(L, file->open(mode) ? 1 : 0);
+		luax_pushboolean(L, file->open(mode));
 	}
 	catch (love::Exception &e)
 	{