Conflict b/w Yanfly Target Info and Kread-Ex Chain Battle

Now, the game loads up fine, combat functions fine, even the scan ability/function created by Yanfly's enemy target info operates properly.

The error pops when battle ends, when no chain battle initiates.
This is the error that pops up:
line 761: NoMethodError
undefined method 'active' for nil:NilClass

This is the section of code the error is referencing:
Code:
#--------------------------------------------------------------------------
  # process_enemy_window_input
  #--------------------------------------------------------------------------
  def process_enemy_window_input
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless SceneManager.scene.enemy_window.active         ### This is line 761###
    return if SceneManager.scene.enemy_window.select_all?
    SceneManager.scene.toggle_enemy_info if Input.trigger?(@button)
    return unless self.visible
    SceneManager.scene.enemy_info_page_up if Input.trigger?(:L)
    SceneManager.scene.enemy_info_page_down if Input.trigger?(:R)
  end

And here's the github links to both scripts:
Yanfly
Kread-Ex
https://github.com/Archeia/Kread-Ex...Scripts/Gameplay Scripts/Grathnode_Install.rb
Is it possible to have a patch/fix for this conflict?
Thanks in advance!

Cheers,
~Lit
Try to insert this line just above the error line:
Code:
return unless SceneManager.scene.enemy_window
Try to insert this line just above the error line:
Code:
return unless SceneManager.scene.enemy_window

@Sixth I appreciate your assistance with these Yanfly bug fixes
However, after pasting the code you gave me into the line above 761, this error popped, under the same circumstances (end of battle, when no chain battle occurred).

line: 980 nomethoderror
undefined method 'select_all?' for nil:nilclass

Here's line 980:

Code:
#--------------------------------------------------------------------------
  # update_visibility
  #--------------------------------------------------------------------------
  def update_visibility
    return unless SceneManager.scene_is?(Scene_Battle)
    return if SceneManager.scene.enemy_window.select_all?   ###this is line 980###
    self.visible = SceneManager.scene.enemy_window.active    
  end
Add the same line above that error line too.

This is really just a workaround fix, the real issue here is that something that should stop being updated still tries to update itself.
For that reason, you might encounter more of these errors, when the code looks for the @enemy_window which is already disposed and cleared from the scene.
Add the same line above that error line too.

This is really just a workaround fix, the real issue here is that something that should stop being updated still tries to update itself.
For that reason, you might encounter more of these errors, when the code looks for the @enemy_window which is already disposed and cleared from the scene.

I understand it's frustrating. Thank you for all of your assistance!
For the time being, this bug seems to be stopped. I'll take workarounds so long as everything functions properly.

Cheers,
~Lit

Original thread: https://forums.rpgmakerweb.com/threads/conflict-b-w-yanfly-target-info-and-kread-ex-chain-battle.83643/