stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

initialize extra_network_data before use

Open hananbeer opened this issue 1 year ago • 0 comments

Fixes this error: UnboundLocalError: local variable 'extra_network_data' referenced before assignment

extra_network_data is defined inside a loop but accessed outside it. if n_iter is 0 then the loop is never entered and extra_network_data is never initialized.

also a thing to consider is extra_networks.activate() is called in each loop but extra_networks.deactivate() is only called once outside. perhaps this could have undesired side effects? for example if the last extra_network_data in the loop is different from previous ones, only this extra_network_data will be deactivated.

hananbeer avatar Mar 13 '23 15:03 hananbeer