From d878501070e4b67c78794dfdd52b0487b062cf2b Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Wed, 13 Mar 2019 21:14:04 +0100 Subject: [PATCH] fix nil issue --- server/mapblockaccessor/get.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/mapblockaccessor/get.go b/server/mapblockaccessor/get.go index ffeafab..f6f8a93 100644 --- a/server/mapblockaccessor/get.go +++ b/server/mapblockaccessor/get.go @@ -28,7 +28,11 @@ func (a *MapBlockAccessor) GetMapBlock(pos *coords.MapBlockCoords) (*mapblockpar cachedblock, found := a.blockcache.Get(key) if found { getCacheHitCount.Inc() - return cachedblock.(*mapblockparser.MapBlock), nil + if cachedblock == nil { + return nil, nil + } else { + return cachedblock.(*mapblockparser.MapBlock), nil + } } timer := prometheus.NewTimer(dbGetDuration)