Regarding the anchor tag. I can’t think why that would cause scroll issue without doing that, but empty tags are bad practice. You could at least put a non-breaking space in it.
<a href="#"> </a>
The trouble with an empty anchor is that a screen reader wont have anything to read out, so a person with sight impairment wont be able to understand what this link is for, particularly as you have also omitted the title property.
The condition will return false if the field is empty, anyway.
If you just check if the field is empty, it doesn’t help you, because even if the field contains a value, the file might have been removed. You site will then break with a PHP error, saying that you are trying to use an object method on a non-existing object.
@lindeman Sorry to confuse you, isNotEmpty() is best used on a field that contains a plain text value (like a page title). If you dealing with files and images, its best to use the method @texnixe explained to check that the file physically exists. My bad, sorry.
You can pull your default image from the assets folder, so you do not have to store it in your article(s). This way you only have one copy of the image to maintain.