mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-31 08:41:32 +00:00
Fix crash if someone evil calls the .lines method on a non-file
This commit is contained in:
parent
5f745f4074
commit
6d8753e5a8
1 changed files with 3 additions and 1 deletions
|
@ -190,7 +190,9 @@ namespace MWLua
|
|||
return seek(lua, self, std::ios_base::cur, off);
|
||||
});
|
||||
handle["lines"] = [](sol::this_state lua, sol::object self) {
|
||||
return sol::as_function([lua, self]() {
|
||||
return sol::as_function([lua, self]() -> sol::object {
|
||||
if (!self.is<FileHandle*>())
|
||||
return sol::nil;
|
||||
FileHandle* handle = self.as<FileHandle*>();
|
||||
validateFile(*handle);
|
||||
return readLineFromFile(lua, *handle);
|
||||
|
|
Loading…
Reference in a new issue