[VX Ace] CTD with Yanfly Cast Animations

While using this, I've run into a rather strange CTD. Everything is fine unless I use the right arrow key to guard; if I do that, I get a CTD with this error:

Script 'YEA Cast Animations' line 196: NoMethodError
occurred.

undefined method 'cast_ani' for nil:NilClass

Looking through the script, line 196 shows this (the line in question is bolded and underlined):

Spoiler
#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base

#--------------------------------------------------------------------------
# alias method: use_item
#--------------------------------------------------------------------------
alias scene_battle_use_item_cani use_item
def use_item
process_casting_animation unless $imported["YEA-BattleEngine"]
scene_battle_use_item_cani
end

#--------------------------------------------------------------------------
# new method: process_casting_animation
#--------------------------------------------------------------------------
def process_casting_animation
item = @subject.current_action.item
cast_ani = item.cast_ani
return if cast_ani <= 0
show_animation([@subject], cast_ani)
end

end # Scene_Battle

What's going on, and how do I fix it?
Sorry for the bump, but it's been over a month and I still can't fix this problem. Please help.

EDIT: Also, now it's happening whenever any actor/enemy does a normal attack.
Have you set up cast animations for everything? e.g. <cast ani: x> or <no cast ani>
No idea how can the item be nil there, but you can try to add this line right above the error line:
Code:
return unless item

I see you writing this "CTD" thing all around, and was wondering for a while now... What does that mean? o.o

Please use code tags for code lines next time! Those code lines are surely mad at you now! *.*
If all those tips don't help, then follow the link "how to use a script" in my signature to the bughunting section, install the backtracer and give us a Screenshot of the console when the error happens again.

Edit: @Sixth crash to desktop
If it is caused by pressing the right arrow to guard, then block the right arrow. That's what I have in my game. I have to select guard in the list of actor commands to have the member guard.
This is Theoallen's right arrow fix.
Spoiler: snippet
Code:
# TheoAllen
class Window_ActorCommand
 
  # --------------------------------------------------------------------------
  # Delete Handling
  # --------------------------------------------------------------------------
  def process_dir6
  end
 
  def process_dir4
  end
 
end

class Scene_Battle
  # --------------------------------------------------------------------------
  # Overwrites
  # --------------------------------------------------------------------------
  def create_actor_command_window
    scene_battle_create_actor_command_window_abe
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-ctd-with-yanfly-cast-animations.92202/