Skip to content

Commit

Permalink
fixed give and take points nil user crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonp committed Jul 9, 2014
1 parent d975e39 commit 335264b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions botspade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,19 @@ def save_data_silent
def take_points(person, points)
# Newer Fancy Way
user = get_user(person)
newpoints = user[2] - points
db_checkins_save(user[0], newpoints)
if (user)
newpoints = user[2] - points
db_checkins_save(user[0], newpoints)
end
end

def give_points(person, points)
# Newer Fancy Way
user = get_user(person)
newpoints = user[2] + points
db_checkins_save(user[0], newpoints)
if (user)
newpoints = user[2] + points
db_checkins_save(user[0], newpoints)
end
end

def person_has_enough_points(nick, points_required)
Expand Down

0 comments on commit 335264b

Please sign in to comment.