Issue when effect has no targets

I had this issue in multi-thread application, but in any case it seems strange to me not to make this check.

Sorry about two commits. Only one should be there, that one: bcbb7e6