#fixed code
                                private void cacheBlockToBuffer(Block block) {
        blockCacheBuffer.cacheBlock(block);
        BlockLog.info("orphan cache block height:" + block.getHeader().getHeight() + ", preHash:" + block.getHeader().getPreHash() + " , hash:" + block.getHeader().getHash() + ", address:" + Address.fromHashs(block.getHeader().getPackingAddress()));
        Block preBlock = blockCacheBuffer.getBlock(block.getHeader().getPreHash().getDigestHex());
        if (preBlock == null) {
            if (this.downloadService.getStatus() != DownloadStatus.DOWNLOADING) {
                downloadUtils.getBlockByHash(block.getHeader().getPreHash().getDigestHex());
            }
        } else {
            this.addBlock(preBlock, true, null);
        }
    }
#vulnerable code 
                                private void cacheBlockToBuffer(Block block) {
        blockCacheBuffer.cacheBlock(block);
        BlockLog.info("orphan cache block height:" + block.getHeader().getHeight() + ", preHash:" + block.getHeader().getPreHash() + " , hash:" + block.getHeader().getHash() + ", address:" + Address.fromHashs(block.getHeader().getPackingAddress()));
        Block preBlock = blockCacheBuffer.getBlock(block.getHeader().getPreHash().getDigestHex());
        if (preBlock == null) {
            if (NulsContext.getServiceBean(DownloadService.class).getStatus() != DownloadStatus.DOWNLOADING) {
                downloadUtils.getBlockByHash(block.getHeader().getPreHash().getDigestHex());
            }
        } else {
            this.addBlock(preBlock, true, null);
        }
    } 
                            #location 6 
                            #vulnerability type NULL_DEREFERENCE