Fix breaking on HTML email without images (#22143)
Fix breaking on HTML email without images (#22143)

* Fix breaking on HTML email without images

If using html emails with no images the code breaks since it is not tested for empty (uninitialized) key images.

* fixed long line

* Implemented suggested better solution

Better solution to allow data -> html email without images.

* Protecting data -> without html key from crashing

If the data key does not contain the html key, sending the email would crash this "script". Preventing this by returning an default empty array.

aequitas/home-assistant,home-assistant/home-assistant,jamespcole/home-assistant,fbradyirl/home-assistant,rohitranjan1991/home-assistant,jabesq/home-assistant,postlund/home-assistant,balloob/home-assistant,joopert/home-assistant,lukas-hetzenecker/home-assistant,partofthething/home-assistant,soldag/home-assistant,kennedyshead/home-assistant,DavidLP/home-assistant,rohitranjan1991/home-assistant,turbokongen/home-assistant,titilambert/home-assistant,jamespcole/home-assistant,auduny/home-assistant,leppa/home-assistant,balloob/home-assistant,jabesq/home-assistant,Danielhiversen/home-assistant,robbiet480/home-assistant,adrienbrault/home-assistant,tboyce021/home-assistant,fbradyirl/home-assistant,joopert/home-assistant,kennedyshead/home-assistant,mKeRix/home-assistant,leppa/home-assistant,aronsky/home-assistant,titilambert/home-assistant,molobrakos/home-assistant,molobrakos/home-assistant,jnewland/home-assistant,qedi-r/home-assistant,nkgilley/home-assistant,aequitas/home-assistant,mKeRix/home-assistant,MartinHjelmare/home-assistant,sander76/home-assistant,GenericStudent/home-assistant,pschmitt/home-assistant,DavidLP/home-assistant,soldag/home-assistant,jabesq/home-assistant,Teagan42/home-assistant,molobrakos/home-assistant,mezz64/home-assistant,toddeye/home-assistant,tboyce021/home-assistant,tchellomello/home-assistant,FreekingDean/home-assistant,robbiet480/home-assistant,fbradyirl/home-assistant,home-assistant/home-assistant,auduny/home-assistant,tboyce1/home-assistant,mKeRix/home-assistant,tboyce1/home-assistant,turbokongen/home-assistant,partofthething/home-assistant,sander76/home-assistant,jamespcole/home-assistant,nkgilley/home-assistant,qedi-r/home-assistant,toddeye/home-assistant,jawilson/home-assistant,tboyce1/home-assistant,pschmitt/home-assistant,MartinHjelmare/home-assistant,sdague/home-assistant,MartinHjelmare/home-assistant,FreekingDean/home-assistant,adrienbrault/home-assistant,balloob/home-assistant,mezz64/home-assistant,auduny/home-assistant,jnewland/home-assistant,rohitranjan1991/home-assistant,sdague/home-assistant,jnewland/home-assistant,GenericStudent/home-assistant,Cinntax/home-assistant,w1ll1am23/home-assistant,lukas-hetzenecker/home-assistant,Danielhiversen/home-assistant,aronsky/home-assistant,postlund/home-assistant,DavidLP/home-assistant,aequitas/home-assistant,mKeRix/home-assistant,w1ll1am23/home-assistant,Teagan42/home-assistant,tboyce1/home-assistant,jawilson/home-assistant,tchellomello/home-assistant,Cinntax/home-assistant