Skip to content

NPE when generating a chunk #24

Description

@rvandoosselaer

When using the ChunkPager it happened once that a Chunk was evicted from the ChunkCache while the ChunkManager was still generating the mesh.

This resulted in a NPE in the Chunk class:

public Block getBlock(int x, int y, int z) {
    if (isInsideChunk(x, y, z)) {
        return this.blocks[calculateIndex(x, y, z)];
    }
    ...

the this.blocks variable is null when the chunk is cleaned up.

This doesn't break the functionality since the ChunkPager decided that the chunk should not be rendered (hence the evict). But there is probably a better way to handle this behaviour. All tasks for chunks that are discarded should be aborted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions