mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 06:51:51 +00:00
fix segfault on world.get_chunk_data if no world open
This commit is contained in:
parent
5a040893f1
commit
4a11dd28ec
1 changed files with 5 additions and 2 deletions
|
|
@ -129,6 +129,9 @@ static int l_get_generator(lua::State* L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_get_chunk_data(lua::State* L) {
|
static int l_get_chunk_data(lua::State* L) {
|
||||||
|
if (level == nullptr) {
|
||||||
|
throw std::runtime_error("world is not open");
|
||||||
|
}
|
||||||
int x = static_cast<int>(lua::tointeger(L, 1));
|
int x = static_cast<int>(lua::tointeger(L, 1));
|
||||||
int z = static_cast<int>(lua::tointeger(L, 2));
|
int z = static_cast<int>(lua::tointeger(L, 2));
|
||||||
const auto& chunk = level->chunks->getChunk(x, z);
|
const auto& chunk = level->chunks->getChunk(x, z);
|
||||||
|
|
@ -175,7 +178,7 @@ static void integrate_chunk_client(Chunk& chunk) {
|
||||||
|
|
||||||
static int l_set_chunk_data(lua::State* L) {
|
static int l_set_chunk_data(lua::State* L) {
|
||||||
if (level == nullptr) {
|
if (level == nullptr) {
|
||||||
throw std::runtime_error("no open world");
|
throw std::runtime_error("world is not open");
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = static_cast<int>(lua::tointeger(L, 1));
|
int x = static_cast<int>(lua::tointeger(L, 1));
|
||||||
|
|
@ -201,7 +204,7 @@ static int l_set_chunk_data(lua::State* L) {
|
||||||
|
|
||||||
static int l_save_chunk_data(lua::State* L) {
|
static int l_save_chunk_data(lua::State* L) {
|
||||||
if (level == nullptr) {
|
if (level == nullptr) {
|
||||||
throw std::runtime_error("no open world");
|
throw std::runtime_error("world is not open");
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = static_cast<int>(lua::tointeger(L, 1));
|
int x = static_cast<int>(lua::tointeger(L, 1));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue