Sign in to follow this  

Calling NotifyChanged on a negotiation card without a deck causes game to crash


RageLeague
  • Branch: Preview Branch Version: Windows Pending
function Card:NotifyChanged()
    local clone = self:Clone()
    if self.engine then
        -- Lock in the current damage and modifier string for this card, so that the UI
        -- will have the correct values generated from this point in time.
        local min_persuasion, max_persuasion, details = self.engine:PreviewPersuasion( self )
        clone.CalculatePersuasion = function( self )
            return min_persuasion, max_persuasion, details
        end
    end

    self.deck.engine:BroadcastEvent( EVENT.CARD_CHANGED, self, clone )
    return clone
end

title.

as you can see, on the third to last line, the self.deck part was completely unnecessary, as you can directly get the engine from self. However, if this is called on a card that's not in a deck, it will crash the game, since you're indexing on a nil value.


Steps to Reproduce

1. generate a card that's not in a deck with code.

2. call NotifyChange while this card is not part of any deck.

3. crash game.

Sign in to follow this  


User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now