Dataview/dataviewjs: How to fetch Tasks that are in the outgoing links of a note

Small update (image link in note causes error):

I am facing an issue where pasting an image link in the note makes the code output error (because of the for loop presumably):

Evaluation Error: TypeError: Cannot read properties of undefined (reading 'file')

I am opening a different question in the forum for that. (here)