mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
refactor: PVS-Studio warnings fixes
This commit is contained in:
parent
245b39be62
commit
47db626145
14 changed files with 81 additions and 69 deletions
|
|
@ -49,11 +49,11 @@ static int l_hud_open_block(lua::State* L) {
|
|||
std::to_string(y) + " " + std::to_string(z)
|
||||
);
|
||||
}
|
||||
auto def = content->getIndices()->blocks.get(vox->id);
|
||||
auto& def = content->getIndices()->blocks.require(vox->id);
|
||||
auto assets = engine->getAssets();
|
||||
auto layout = assets->get<UiDocument>(def->uiLayout);//FIXME: Potentional null pointer //-V522
|
||||
auto layout = assets->get<UiDocument>(def.uiLayout);
|
||||
if (layout == nullptr) {
|
||||
throw std::runtime_error("block '" + def->name + "' has no ui layout");
|
||||
throw std::runtime_error("block '" + def.name + "' has no ui layout");
|
||||
}
|
||||
|
||||
auto id = blocks->createBlockInventory(x, y, z);
|
||||
|
|
@ -65,7 +65,7 @@ static int l_hud_open_block(lua::State* L) {
|
|||
);
|
||||
|
||||
lua::pushinteger(L, id);
|
||||
lua::pushstring(L, def->uiLayout);
|
||||
lua::pushstring(L, def.uiLayout);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue