fix: PVS-Studio V522 mark false
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
@@ -154,9 +154,9 @@ std::unique_ptr<Atlas> BlocksPreview::build(
|
||||
|
||||
fbo.bind();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
auto def = indices->blocks.get(i);
|
||||
auto def = indices->blocks.get(i); //FIXME: Potentional null pointer
|
||||
atlas->getTexture()->bind();
|
||||
builder.add(def->name, draw(cache, shader, &fbo, &batch, def, iconSize));
|
||||
builder.add(def->name, draw(cache, shader, &fbo, &batch, def, iconSize)); //-V522
|
||||
}
|
||||
fbo.unbind();
|
||||
|
||||
|
||||
@@ -141,11 +141,11 @@ void Skybox::refresh(const DrawContext& pctx, float t, float mie, uint quality)
|
||||
ctx.setFramebuffer(fbo.get());
|
||||
ctx.setViewport(Viewport(size, size));
|
||||
|
||||
auto cubemap = dynamic_cast<Cubemap*>(fbo->getTexture());
|
||||
auto cubemap = dynamic_cast<Cubemap*>(fbo->getTexture()); //FIXME: Potentional null pointer
|
||||
|
||||
ready = true;
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
cubemap->bind();
|
||||
cubemap->bind(); //-V522
|
||||
shader->use();
|
||||
|
||||
const glm::vec3 xaxs[] = {
|
||||
|
||||
@@ -172,10 +172,10 @@ void WorldRenderer::setupWorldShader(
|
||||
{
|
||||
auto inventory = player->getInventory();
|
||||
ItemStack& stack = inventory->getSlot(player->getChosenSlot());
|
||||
auto item = indices->items.get(stack.getItemId());
|
||||
auto item = indices->items.get(stack.getItemId()); //FIXME: Potentional null pointer
|
||||
float multiplier = 0.5f;
|
||||
shader->uniform3f("u_torchlightColor",
|
||||
item->emission[0] / 15.0f * multiplier,
|
||||
item->emission[0] / 15.0f * multiplier, //-V522
|
||||
item->emission[1] / 15.0f * multiplier,
|
||||
item->emission[2] / 15.0f * multiplier
|
||||
);
|
||||
@@ -222,12 +222,12 @@ void WorldRenderer::renderBlockSelection() {
|
||||
const auto& selection = player->selection;
|
||||
auto indices = level->content->getIndices();
|
||||
blockid_t id = selection.vox.id;
|
||||
auto block = indices->blocks.get(id);
|
||||
auto block = indices->blocks.get(id); //FIXME: Potentional null pointer
|
||||
const glm::ivec3 pos = player->selection.position;
|
||||
const glm::vec3 point = selection.hitPosition;
|
||||
const glm::vec3 norm = selection.normal;
|
||||
|
||||
const std::vector<AABB>& hitboxes = block->rotatable
|
||||
const std::vector<AABB>& hitboxes = block->rotatable //-V522
|
||||
? block->rt.hitboxes[selection.vox.state.rotation]
|
||||
: block->hitboxes;
|
||||
|
||||
|
||||
@@ -121,9 +121,9 @@ void SlotView::draw(const DrawContext* pctx, Assets* assets) {
|
||||
itemid_t itemid = bound->getItemId();
|
||||
if (itemid != prevItem) {
|
||||
if (itemid) {
|
||||
auto def = content->getIndices()->items.get(itemid);
|
||||
auto def = content->getIndices()->items.get(itemid); //FIXME: Potentional null pointer
|
||||
tooltip = util::pascal_case(
|
||||
langs::get(util::str2wstr_utf8(def->caption))
|
||||
langs::get(util::str2wstr_utf8(def->caption)) //-V522
|
||||
);
|
||||
} else {
|
||||
tooltip.clear();
|
||||
@@ -159,8 +159,8 @@ void SlotView::draw(const DrawContext* pctx, Assets* assets) {
|
||||
auto previews = assets->get<Atlas>("block-previews");
|
||||
auto indices = content->getIndices();
|
||||
|
||||
ItemDef* item = indices->items.get(stack.getItemId());
|
||||
switch (item->iconType) {
|
||||
ItemDef* item = indices->items.get(stack.getItemId()); //FIXME: Potentional null pointer
|
||||
switch (item->iconType) { //-V522
|
||||
case item_icon_type::none:
|
||||
break;
|
||||
case item_icon_type::block: {
|
||||
@@ -268,12 +268,12 @@ void SlotView::clicked(gui::GUI* gui, mousecode button) {
|
||||
stack.setCount(halfremain);
|
||||
}
|
||||
} else {
|
||||
auto stackDef = content->getIndices()->items.get(stack.getItemId());
|
||||
auto stackDef = content->getIndices()->items.get(stack.getItemId()); //FIXME: Potentional null pointer
|
||||
if (stack.isEmpty()) {
|
||||
stack.set(grabbed);
|
||||
stack.setCount(1);
|
||||
grabbed.setCount(grabbed.getCount()-1);
|
||||
} else if (stack.accepts(grabbed) && stack.getCount() < stackDef->stackSize){
|
||||
} else if (stack.accepts(grabbed) && stack.getCount() < stackDef->stackSize){ //-V522
|
||||
stack.setCount(stack.getCount()+1);
|
||||
grabbed.setCount(grabbed.getCount()-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user