Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added asserts to check for null enities

  • Loading branch information...
commit f506442a1af8c8288c4367b035e1b6357e9bffdc 1 parent 4098884
@Textmode Textmode authored
Showing with 3 additions and 0 deletions.
  1. +2 −0  powerup.lua
  2. +1 −0  space.lua
View
2  powerup.lua
@@ -50,6 +50,7 @@ function _M:dohit()
end
function _M:doeffect(e)
+ assert(e, "Can't effect nothing")
if self.effect == 'heal10' then
e:heal(e.shieldmax*.1)
elseif self.effect == 'heal30' then
@@ -65,6 +66,7 @@ function _M:doeffect(e)
end
function _M:collidewith(e, dt)
+ assert(e, "Can't collide with nothing")
self:doeffect(e)
self:dohit()
end
View
1  space.lua
@@ -190,6 +190,7 @@ function state:update(dt)
local enemies = self.enemies
for i=1,#enemies do
ship = enemies[i]
+ assert(ship, "Woops, grabbed nothing.")
if ship then
ship:update(dt, level)
-- Ideally, the player would be a normal entity, for now we
Please sign in to comment.
Something went wrong with that request. Please try again.