Skip to content
This repository has been archived by the owner on Nov 21, 2017. It is now read-only.

Commit

Permalink
Fix nil when accessing biter scents data
Browse files Browse the repository at this point in the history
  • Loading branch information
Afforess committed Apr 3, 2016
1 parent a792eb3 commit b84872c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PACKAGE_NAME := Misanthrope
VERSION_STRING := 0.3.5
VERSION_STRING := 0.3.6

OUTPUT_NAME := $(PACKAGE_NAME)_$(VERSION_STRING)
OUTPUT_DIR := build/$(OUTPUT_NAME)
Expand Down
10 changes: 6 additions & 4 deletions libs/region/biter_scents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ function biter_scents.tick(cache)
end

function biter_scents.get_value(cache, x, y)
local x_idx = bit32.band(x, 0x7F)
local y_idx = bit32.band(y, 0x7F)
if cache.values[x_idx] and cache.values[x_idx][y_idx] then
return cache.values[x_idx][y_idx]
if cache and cache.values then
local x_idx = bit32.band(x, 0x7F)
local y_idx = bit32.band(y, 0x7F)
if cache.values[x_idx] and cache.values[x_idx][y_idx] then
return cache.values[x_idx][y_idx]
end
end
return 0
end
Expand Down

0 comments on commit b84872c

Please sign in to comment.