Game crashes after enemies get defeated by a counter.

Hello everyone, I hope this is the correct place to ask this, sorry if not it's my first post.

So I am using VX Ace and fomar's atk bar script. I turned it into a CTB system and everything was working perfectly fine
until I discovered a bug/error of sorts by accident today.

When the enemies get defeated by a counter attack, I get an error message and the game shuts down.

1716732128112.png


This is my error message. And this is where in the script the error lies:

1716732171653.png


I have 0 scripting knowledge so I am not able to understand what the script is trying to tell me.

Could anyone please help me out with this one?

Thank you in advance!
Right above that line add in return if @actions.empty?
Ruby:
    else
      return if @actions.empty?
      @stamina -= @actions[0].stamina_cost
    end
Thank you so so much, this fixed it!

Original thread: https://forums.rpgmakerweb.com/threads/game-crashes-after-enemies-get-defeated-by-a-counter.169014/