From 37da594a5896cd7a4cd695bcb9e79d2d720b2c1a Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Thu, 16 Jun 2016 12:09:34 +0300 Subject: [PATCH] check for nil account on actions that need one --- engine/action.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/action.go b/engine/action.go index 03d81e289..51f35b42a 100644 --- a/engine/action.go +++ b/engine/action.go @@ -583,6 +583,9 @@ func removeAccountAction(ub *Account, sq *StatsQueueTriggered, a *Action, acs Ac } func removeBalanceAction(ub *Account, sq *StatsQueueTriggered, a *Action, acs Actions) error { + if ub == nil { + return fmt.Errorf("nil account for %s action", utils.ToJSON(a)) + } if _, exists := ub.BalanceMap[a.Balance.GetType()]; !exists { return utils.ErrNotFound } @@ -605,6 +608,9 @@ func removeBalanceAction(ub *Account, sq *StatsQueueTriggered, a *Action, acs Ac } func setBalanceAction(acc *Account, sq *StatsQueueTriggered, a *Action, acs Actions) error { + if acc == nil { + return fmt.Errorf("nil account for %s action", utils.ToJSON(a)) + } return acc.setBalanceAction(a) }