fix world deletion & fix segfault on attempt to reset content when world is open
This commit is contained in:
parent
010ed78aba
commit
e0440b263e
@ -34,9 +34,10 @@ EngineController::EngineController(Engine& engine) : engine(engine) {
|
||||
void EngineController::deleteWorld(const std::string& name) {
|
||||
fs::path folder = engine.getPaths().getWorldFolderByName(name);
|
||||
|
||||
auto deletion = [&]() {
|
||||
auto deletion = [this, folder]() {
|
||||
logger.info() << "deleting " << folder;
|
||||
fs::remove_all(folder);
|
||||
engine.getGUI()->getMenu()->back();
|
||||
};
|
||||
|
||||
if (engine.isHeadless()) {
|
||||
|
||||
@ -36,6 +36,9 @@ static int l_load_content(lua::State* L) {
|
||||
}
|
||||
|
||||
static int l_reset_content(lua::State* L) {
|
||||
if (level != nullptr) {
|
||||
throw std::runtime_error("world must be closed before");
|
||||
}
|
||||
engine->resetContent();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user